Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem passing parameters to SQL server stored proc
Message
From
05/06/2003 13:31:44
 
 
To
05/06/2003 11:18:52
Philip Jones
Cornwall County Council
Truro, United Kingdom
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00796748
Message ID:
00796841
Views:
9
This message has been marked as the solution to the initial question of the thread.
I see two issues here - you defined the parameter as return type when it should be output type and you didn't specify Precision and Scale.

Try this instead:
  p.Append .CreateParameter("@addressid", adNumeric, adParamOutput, 0)
  p("@addressid").Precision = 18
  p("@addressid").NumericScale = 0
Roman


>Hi,
>Please somebody help me before I have to go out and kill someone's dog with a stick.
>I've been struggling with this for ages. Here is the asp code
>
>Set Conn = Server.CreateObject("ADODB.Connection")
>Conn.Open "xxxxx","xxxxx","xxxxxx"
>
>Set Cmd = Server.createObject("ADODB.command")
>Set Cmd.ActiveConnection = Conn
>
>With Cmd
> .CommandText="testaddress"
> .CommandType=adCmdStoredProc
> set p = .parameters
> p.Append .CreateParameter("@addressid", adNumeric, adParamReturnValue, 18)
> p.Append .CreateParameter("@aaaaa", adChar, adParamInput, 40)
> p.Append .CreateParameter("@bbbbb", adChar, adParamInput, 30)
> Cmd("@aaaaa")="flflflflflflf"
> Cmd("@bbbbb")="baaaaaaaaaastard"
> .Execute
>End With
>
>----------------------
>
>Here is the sql code
>-----------------------
>PROCEDURE testaddress
>@addressid Numeric (18) OUTPUT,
>@aaaaa char(40), @bbbbb char(30) -- parameters for address info
>AS
>
>INSERT INTO Job (Jo_JobTitle, Jo_SunType) VALUES (@aaaaa, @bbbbb)
>-- error handling omitted
>
>SET @addressid = SCOPE_IDENTITY()
>GO
>
>
>---------------------------------------
>
>
>The problem is this...
>
>p.Append .CreateParameter("@addressid", adNumeric, adParamReturnValue, 18)
>
>cos if I take it out the whole thing works fine.
>
>I keep getting an error message saying "Invalid scale value"
>
>I know that the precision, scale and length of the field in the table are 0, 18, and 9.
>
>What am I doing wrong?
Roman Rehak, MCSD, MCDBA, MCSA
Competitive Computing
354 Mountain View Drive
Colchester, VT 05446-5824
802-764-1729
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform