Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: stroed procedures errors


Message #1 by svirtue@b... on Wed, 26 Sep 2001 16:02:44
Hi,



I am using the following to connect to my access database and access a 

stored procedure.

Set myConn = Server.CreateObject("ADODB.Connection")

driverSource = "Provider=Microsoft.Jet.OLEDB.4.0"

driverSource = driverSource & "; Data Source=C:\home\website\database-

97.mdb"

myConn.ConnectionString = driverSource

myConn.open



Set myComm = Server.CreateObject("ADODB.Command")

Set myComm.ActiveConnection = myConn

myComm.CommandText = "{CALL selectEventAll ('" & (evid) & "')}"

Set objRS = Server.CreateObject("ADODB.RecordSet")

Set objRS = myComm.Execute



The stored procedure i am using is

PARAMETERS [eventid] Short;

SELECT *

FROM Event, Event_Details, Venue

WHERE (Event.event_ID = [eventid])

AND  (Venue.Venue_ID = Event_Details.Venue_ID)

AND (Event.Event_ID = Event_Details.Event_ID);



The error message i get is 

Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', 

or 'UPDATE'. 



/editEvent.asp, line 26 



I have no idea why i am getting the error message let alon how to fix it. 

Can anyone help me please



Sam
Message #2 by Anupama Nallari <ANallari@p...> on Wed, 26 Sep 2001 10:08:17 -0500
I am using SQL Server 7 stored proceudre. This is how I access it and pass

parameters.

 

//my parameter variables.

struserid=trim(ucase(Request.Form("userid")))

strpassword=trim(Request.Form("password1"))



//creating the connection object

set myconn =server.CreateObject("ADODB.connection")

myconn.Open "SUPPORTWEB", "sa"





//This is the important part of creating the command object. In your code

your did not set the commandtype property and just give it then name of the

stored procedure.



Set cmd = Server.CreateObject("ADODB.Command")

Set cmd.ActiveConnection = myconn

	cmd.CommandType = adCmdStoredProc

	cmd.CommandText = "spkf_logon"



//create the parameters including the return values if u have any

	

Set prmLoginID = cmd.CreateParameter ("LoginID", adVarChar, adParamInput,

15,struserid)

Set prmPassword = cmd.CreateParameter ("Password", adVarChar, adParamInput,

15,strpassword)

Set prmReturnValue = cmd.CreateParameter ("ReturnValue", adInteger,

adParamOutput)



//append the parameters



cmd.Parameters.Append prmLoginID

cmd.Parameters.Append prmPassword

cmd.Parameters.Append prmReturnValue



//Execute



cmd.EXECUTE

ReturnValue = prmReturnValue.Value







I hope that solves your problem



Anu


  Return to Index