error in stored procedure and ASP

Last Post 18 Feb 2005 02:13 PM by BobBarker. 1 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
fgeorge
New Member
New Member

--
05 Feb 2005 05:52 AM
I have a field called dependants and its numeric , length 9 in my SQL Server Table.

I have a stored procedure that has a parameter which accepts a value for dependants..
the code is below;

Command1.Parameters.Append Command1.CreateParameter("@dependants", 139, 1,9,Command1__dependants)


but on the line above i get the following error;

ADODB.Command (0x800A0D5D)
Application uses a value of the wrong type for the current operation.

Can anyone tell me what the problem is and the solution.?
Thanks
BobBarker
New Member
New Member

--
18 Feb 2005 02:13 PM
Rather than give you a fish I'll give you a fishing pole.

Whenever you are having trouble figuring out how to set the parameters of a Command object, you can get VB to figure it out for you. Just call the Parameters.Refresh method; this will automatically set all the parameters up for you (it does a round trip to the server and asks SQL Server what the appropriate types and sizes are). With this knowledge you ought to be able to write a couple lines of temporary code to discover exactly what you need to supply. Something like


MyCommand.Parameters.Refresh
For Each Param in MyCommand.Parameters
Debug.Print Param.Name, Param.Type, Param.Size
Next


BB


Acceptable Use Policy
---