comp • gb.db • _connection • subst

Connection.Subst (gb.db)

Function Subst ( Format As String, Arguments As , ... ) As String

Creates a SQL sentence by substituting its arguments into a format string.

  • Format is the SQL sentence.

  • Arguments are the arguments to substitute.

The &1, &2... patterns inside the Format string are replaced by the SQL representation of the 1st, 2nd... Arguments.

These arguments are quoted according to the underlying database SQL syntax.

This method can only quote SQL values. To insert table or field names into a SQL query, you have to use the Quote method.

Examples

PRINT DB.Subst("WHERE Name = &1 AND Date = &2", "Benoit", Now)
WHERE Name = 'Benoit' AND Date = '2006-02-15 11:51:33.043'