|
 |
asp_databases thread: Re: Stored Procedures,parameters, recordsets
Message #1 by ghartge@u... on Thu, 9 Jan 2003 13:35:18
|
|
Phil,
Did you ever figure this out? I am having the same difficulty. I cannot get
my asp page to work. I keep getting an error of "Arguments are of the
wrong type, are out of acceptable range, or are in conflict with one
another." and the line number is the code of .CommandType = adCmdStoredPro
The rest of the code is
'Set recordset
Set rs = Server.CreateObject("ADODB.Recordset")
'Create new connection and set cursor
Set my390connection = Server.CreateObject("ADODB.Connection")
my390connection.CursorLocation = adUseClient
ConnectionString = "DSN=NERDB0T;UID=xxx;PWD=xxxxx;"
'Open the connection
my390connection.Open ConnectionString
'Set command object (references stored procedure)
Set my390command = Server.CreateObject("ADODB.Command")
With my390command
.ActiveConnection = my390connection
.CommandText = "BASCHEMA.BAUDD051"
.CommandType = adCmdStoredProc
Set inparm1 = my390command.CreateParameter("ID", adChar, adParamInput, 8,
"xxxxxxxx")
my390command.Parameters.Append inparm1
...
...
...
etc
> I am attmpting to call a DB2 stored procedure Via ADO from an ASP page.
> Both input and output parameters will be used, and a recordset will be
> returned from the stored procedure. My question regards the proper syntax
> for such - I see examples done 2 different ways. Can anyone shed any
> light on this?
>
> thanks.
>
> #1:
> **** is this SQL Server-specific??? ****
> dim dataConn, sSql, rs, myInt
> myInt = 1 'set myInt to the number we want to pass to the stored
> procedure
> set dataConn = Server.CreateObject("ADODB.Connection")
> dataConn.Open "DSN=webData;uid=user;pwd=password" 'make connection
> sSql = "sp_myStoredProcedure " & myInt
> Set rs = dataConn.Execute(sSql) 'execute sql call
> -------------------------------------------
> #2:
> Set conn = Server.CreateObject("ADODB.Connection")
>
> 'Set rs = Server.CreateObject("ADODB.RecordSet")
>
> conn.Open MFConnectString
> set cmd = Server.CreateObject("ADODB.Command")
> cmd.ActiveConnection = conn
> cmd.CommandType = adCmdStoredProc
>
>
> cmd.CommandText = "ABC.MYPROC"
>
> Set countynbr = cmd.CreateParameter("County_Number", adChar,
> adParamInput, 3, whichcounty)
> cmd.Parameters.Append countynbr
>
> Set recordsetcount = cmd.CreateParameter("Recordset_Count", adChar,
> adParamOutput, 9)
> cmd.Parameters.Append recordsetcount
>
> Set returnmessage = cmd.CreateParameter("Return_Message", adChar,
> adParamOutput, 50)
> cmd.Parameters.Append returnmessage
>
> 'the following instruction seems to crash DBTT !!!
> 'Set rs = cmd.Execute(sSql)
> --------------------------------------
Message #2 by "Ron Williams" <ronwilliams32@c...> on Fri, 10 Jan 2003 16:22:34
|
|
the answer has many possibilities and too much writing for this forum(for
me anyway). i suggest going to Beginning Active Server Pages 3.0 chapter
14. it explains the Ins and Outs of output parameters and some of the
reasons you get that error.
sorry i couldnt help more.
ron
> Phil,
> Did you ever figure this out? I am having the same difficulty. I cannot
get
> my asp page to work. I keep getting an error of "Arguments are of the
w> rong type, are out of acceptable range, or are in conflict with one
a> nother." and the line number is the code of .CommandType =
adCmdStoredPro
> The rest of the code is
> 'Set recordset
> Set rs = Server.CreateObject("ADODB.Recordset")
>
'> Create new connection and set cursor
> Set my390connection = Server.CreateObject("ADODB.Connection")
m> y390connection.CursorLocation = adUseClient
> ConnectionString = "DSN=NERDB0T;UID=xxx;PWD=xxxxx;"
>
'> Open the connection
> my390connection.Open ConnectionString
> 'Set command object (references stored procedure)
> Set my390command = Server.CreateObject("ADODB.Command")
> With my390command
> .ActiveConnection = my390connection
> .CommandText = "BASCHEMA.BAUDD051"
> .CommandType = adCmdStoredProc
> Set inparm1 = my390command.CreateParameter("ID", adChar, adParamInput, 8,
"> xxxxxxxx")
m> y390command.Parameters.Append inparm1
> ...
.> ..
.> ..
e> tc
>
>> I am attmpting to call a DB2 stored procedure Via ADO from an ASP page.
>> Both input and output parameters will be used, and a recordset will be
>> returned from the stored procedure. My question regards the proper
syntax
>> for such - I see examples done 2 different ways. Can anyone shed any
>> light on this?
>>
>> thanks.
>>
>> #1:
>> **** is this SQL Server-specific??? ****
>> dim dataConn, sSql, rs, myInt
>> myInt = 1 'set myInt to the number we want to pass to the stored
>> procedure
>> set dataConn = Server.CreateObject("ADODB.Connection")
>> dataConn.Open "DSN=webData;uid=user;pwd=password" 'make connection
>> sSql = "sp_myStoredProcedure " & myInt
>> Set rs = dataConn.Execute(sSql) 'execute sql call
>> -------------------------------------------
>> #2:
>> Set conn = Server.CreateObject("ADODB.Connection")
>>
>> 'Set rs = Server.CreateObject("ADODB.RecordSet")
>>
>> conn.Open MFConnectString
>> set cmd = Server.CreateObject("ADODB.Command")
>> cmd.ActiveConnection = conn
>> cmd.CommandType = adCmdStoredProc
>>
>>
>> cmd.CommandText = "ABC.MYPROC"
>>
>> Set countynbr = cmd.CreateParameter("County_Number", adChar,
>> adParamInput, 3, whichcounty)
>> cmd.Parameters.Append countynbr
>>
>> Set recordsetcount = cmd.CreateParameter("Recordset_Count", adChar,
>> adParamOutput, 9)
>> cmd.Parameters.Append recordsetcount
>>
>> Set returnmessage = cmd.CreateParameter("Return_Message", adChar,
>> adParamOutput, 50)
>> cmd.Parameters.Append returnmessage
>>
>> 'the following instruction seems to crash DBTT !!!
>> 'Set rs = cmd.Execute(sSql)
>> --------------------------------------
Message #3 by "Gary Hartge" <ghartge@u...> on Fri, 10 Jan 2003 11:38:02 -0500
|
|
Thanks Ron,
I will reread it again.
Gary
-----Original Message-----
From: Ron Williams [mailto:ronwilliams32@c...]
Sent: Friday, January 10, 2003 4:23 PM
To: ASP Databases
Subject: [asp_databases] Re: Stored Procedures,parameters, recordsets
the answer has many possibilities and too much writing for this forum(for
me anyway). i suggest going to Beginning Active Server Pages 3.0 chapter
14. it explains the Ins and Outs of output parameters and some of the
reasons you get that error.
sorry i couldnt help more.
ron
> Phil,
> Did you ever figure this out? I am having the same difficulty. I cannot
get
> my asp page to work. I keep getting an error of "Arguments are of the
w> rong type, are out of acceptable range, or are in conflict with one
a> nother." and the line number is the code of .CommandType
adCmdStoredPro
> The rest of the code is
> 'Set recordset
> Set rs = Server.CreateObject("ADODB.Recordset")
>
'> Create new connection and set cursor
> Set my390connection = Server.CreateObject("ADODB.Connection")
m> y390connection.CursorLocation = adUseClient
> ConnectionString = "DSN=NERDB0T;UID=xxx;PWD=xxxxx;"
>
'> Open the connection
> my390connection.Open ConnectionString
> 'Set command object (references stored procedure)
> Set my390command = Server.CreateObject("ADODB.Command")
> With my390command
> .ActiveConnection = my390connection
> .CommandText = "BASCHEMA.BAUDD051"
> .CommandType = adCmdStoredProc
> Set inparm1 = my390command.CreateParameter("ID", adChar, adParamInput, 8,
"> xxxxxxxx")
m> y390command.Parameters.Append inparm1
> ...
.> ..
.> ..
e> tc
>
>> I am attmpting to call a DB2 stored procedure Via ADO from an ASP page.
>> Both input and output parameters will be used, and a recordset will be
>> returned from the stored procedure. My question regards the proper
syntax
>> for such - I see examples done 2 different ways. Can anyone shed any
>> light on this?
>>
>> thanks.
>>
>> #1:
>> **** is this SQL Server-specific??? ****
>> dim dataConn, sSql, rs, myInt
>> myInt = 1 'set myInt to the number we want to pass to the stored
>> procedure
>> set dataConn = Server.CreateObject("ADODB.Connection")
>> dataConn.Open "DSN=webData;uid=user;pwd=password" 'make connection
>> sSql = "sp_myStoredProcedure " & myInt
>> Set rs = dataConn.Execute(sSql) 'execute sql call
>> -------------------------------------------
>> #2:
>> Set conn = Server.CreateObject("ADODB.Connection")
>>
>> 'Set rs = Server.CreateObject("ADODB.RecordSet")
>>
>> conn.Open MFConnectString
>> set cmd = Server.CreateObject("ADODB.Command")
>> cmd.ActiveConnection = conn
>> cmd.CommandType = adCmdStoredProc
>>
>>
>> cmd.CommandText = "ABC.MYPROC"
>>
>> Set countynbr = cmd.CreateParameter("County_Number", adChar,
>> adParamInput, 3, whichcounty)
>> cmd.Parameters.Append countynbr
>>
>> Set recordsetcount = cmd.CreateParameter("Recordset_Count", adChar,
>> adParamOutput, 9)
>> cmd.Parameters.Append recordsetcount
>>
>> Set returnmessage = cmd.CreateParameter("Return_Message", adChar,
>> adParamOutput, 50)
>> cmd.Parameters.Append returnmessage
>>
>> 'the following instruction seems to crash DBTT !!!
>> 'Set rs = cmd.Execute(sSql)
>> --------------------------------------
|
|
 |