Reply to topic
ASP Stored Procedure
eriweb


Joined: 06 Apr 2004
Posts: 68
Reply with quote
Hi all,

I am trying to use stored procedure with asp, I need to pass in two parameters (username and password), and retrieve results into a recordset. Here is what I have so far:
Code:

Set cnnStoredProc = Server.CreateObject("ADODB.Connection")
   cnnStoredProc.Open "Provider=SQLOLEDB;Data Source=localhost;" _
      & "Initial Catalog=catalog name;User Id=uName;Password=pWord;"

' Create Command object we'll use to execute the SP
   Set cmdStoredProc = Server.CreateObject("ADODB.Command")
   
   ' Set our Command to use our existing connection
   cmdStoredProc.ActiveConnection = cnnStoredProc

cmdStoredProc.CommandText = "sp_MEMBERLOGIN"
   cmdStoredProc.CommandType = adCmdStoredProc

cmdStoredProc.Parameters.Append cmdStoredProc.CreateParameter("USERNAME", adVarChar, adParamInput, 20, "fhabtezion")
   cmdStoredProc.Parameters.Append cmdStoredProc.CreateParameter("PASSWORD", adVarChar, adParamInput, 20, "fhabtezion")

Set rs = cmdStoredProc.Execute

   While not rs.eof
      Response.Write(rs("firstname"))
   End while

   Set cmdStoredProc = Nothing


However, I keep receiving the following error:
ADODB.Parameters error '800a0e7c' Parameter object is improperly defined. Inconsistent or incomplete information was provided.


Any help with this is appreciated, thanks in advance.

Fidel
DatabaseDude


Joined: 04 Mar 2005
Posts: 67
Location: Elkins, WV
Reply with quote
I'm thinking that cmdStoredProc.Parameters.Append needs to appear after the parameter object is created.
ASP Stored Procedure
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic