Note the parameters must be defined in the same order as they appear in the SQL statement. The reason for this is that ADO parameters are not actually named but positional, so for compatibility use proper position.
For SQL Passthrough (wwSQL) this method has extra overhead - for ADO, this method is more efficient. It works both ways, but there's trade offs. For ADO, this will be native. For SQL Passthrough the ?pcVar syntax is native and this mechanism only translates into this scheme.
o.wwsql.AddParameter(lvValue,lcName,lcDirection,lnAdoType,lnSize,lnPrecision)
lcName
The name of the parameter
lcDirection
IN
OUT
lnAdoType
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
lnSize
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.
lnPrecision
Optional - precision for numeric parameters.
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.
Last Updated: 01/19/05 |
© West Wind Technologies, 1996-2010