Used to set named parameters to be passed into SQL statements.

Note that must be defined in the same order as they appear in the SQL statement as native FoxPro parameters are injected as ? parameters, and ADO parameters are always treated sequentially.

For SQL Passthrough (wwSQL) this method has extra overhead - use FoxPro's native ? parameter syntax instead. For ADO, this method is more efficient. It works for mechanisms so if you want to create universally usable code use this method.


Return Value



The Value for the parameter

The name of the parameter


The ADO type. If no type is specified wwSQL will take a best guess.

These values are:

adEmpty                                           0
adTinyInt                                         16
adSmallInt                                        2
adInteger                                         3
adBigInt                                          20
adUnsignedTinyInt                                 17
adUnsignedSmallInt                                18
adUnsignedInt                                     19
adUnsignedBigInt                                  21
adSingle                                          4
adDouble                                          5
adCurrency                                        6
adDecimal                                         14
adNumeric                                         131
adBoolean                                         11
adError                                           10
adUserDefined                                     132
adVariant                                         12
adIDispatch                                       9
adIUnknown                                        13
adGUID                                            72
adDate                                            7
adDBDate                                          133
adDBTime                                          134
adDBTimeStamp                                     135
adBSTR                                            8
adChar                                            129
adVarChar                                         200
adLongVarChar                                     201
adWChar                                           130
adVarWChar                                        202
adLongVarWChar                                    203
adBinary                                          128
adVarBinary                                       204
adLongVarBinary                                   205
adChapter                                         136
adFileTime                                        64
adDBFileTime                                      137
adPropVariant                                     138
adVarNumeric                                      139

Optional - size for the parameter. If you don't specify a default size is used. Note adDouble is used for numerics by default if omitted.

Optional - precision for numeric parameters.


If wwAdoSql.nCodePage = 65001 (UTF-8) string parameters are passed and returned using Unicode. Otherwise string parameters are passed using plain VarChar or Text data.

By default all parameters are passed as VarChar(8000) when using Ansi text, and nVarChar(4000) when Unicode is used. If you specifically need to pass Text or nText explicitly you must override the type with 201 and 203 respectively.

Note, passing Text/nText output parameters is not working with ADO for reasons unknown. ADO will not pass the data to SQL Server but give an Unknown Error exception. Since it's not really possible to assign Text/nText data to a variable anyway, this point is kind of moot. However, the SQL Server docs do mention that it is supported. If you're returning Text/nText data that can't fit into VarChar/nVarChar you should return cursors rather than result values.


oSql.Addparameter(REPL("123 ",3000),"desc")

*** Use desc variable in the passthrough statement
? oSql.Executenonquery("update entries set description=?desc where id=8895")

See also:

Class wwsql

© West Wind Technologies, 1996-2018 • Updated: 03/02/17
Comment or report problem with topic