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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Decimal Parameters for the ADO Command Object

Status
Not open for further replies.

Sameal

Programmer
Aug 6, 2001
142
US
I'm trying to pass a value into a Stored Procedure by using the Parameters collection of the ADO Command Object. When you create and append a parameter to the Parameters collection you must specity the SQL Type and Size as arguments. One of my arguments is a Decimal with a Precision of 10, and Scale of 4. However when I append it in with a Size of 10 it gives me an error saying I've give the incorrect Precision.

However I have tried 14, 4, 10.4, and a few other things. What is the correct size for a Precision:10 Scale:4 Decimal parameter?
 
I think the answer is 9. If you create a decimal(10,4) column in a table the GUI shows the length as 9. Worth a shot. JHall
 
I tried that, got the same error message. Thanks for the suggestion though.
 
Have you tried changing it to numeric instead of decimal? JHall
 
Just tried changing the table, stored proc, and vb code to numeric. Got the same error about Precision being wrong.
 
Okay figured out my problem. Was using the CreateParameter method of the ADO Command object. The method doesn't have a Precision argument so you can't set it. However once i added the parameter I set the Precision property of it explicitly and it worked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top