Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB6 ADO SQL2005 StoredProcedure adDecimal

Status
Not open for further replies.

Tim8w

Programmer
Apr 8, 2003
44
US
I am using ADO in VB6 to call a stored procedure in SQL2005. The stored procedure is looking for data as "decimal(6,5)". My data is a double in VB6. In VB6, I tried setting up the call as follows (This is right out of an ADO book):

Code:
SQLCommand.Parameters.Append .CreateParameter("@Offset", adDecimal, adParamInput, , dMyDoubleValue)
SQLCommand.Parameters("@Offset").Precision = 6
SQLCommand.Parameters("@Offset").NumericScale = 5

After doing a trace, the number I passed -0.03125 is converted in the trace to -312.

In another forum, they told me that this is because NumericScale and Precision are enumerated types correspond to adDouble and adCurrency.

I don't know which is correct. The way ADO converted the data it sent to SQL, I'd assume that the enumerated explanation is correct. If that's true, how can I get it to be sent to SQL correctly?
 
Try passing your decimal value as a string to your stored procedure. SQL will do an implicit coversion.
 
You may try replacing .Parameters.Append and parameter definition with

.Parameters.Refresh
.Parameters("@Offset")=0.03125

HTH

[pipe]
Daniel Vlas
Systems Consultant

 
danvlas,
Tried this. Got the same problem, although I did find it interesting that the Refresh returned a type of adNumeric instead of adDecimal...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top