Information générale
Titre:
Problem passing parameters to SQL server stored proc
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?
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement