Link to home
Start Free TrialLog in
Avatar of captgriggs1
captgriggs1

asked on

Stored procedures via asp

Please help, I'm not a SQL guy.  Having trouble with closing a post survey on a stored procedure that works but cannot trigger it via asp.  This is a two part process with 2 asp pages and 2 stored procedures, the survey then a post thank you message and storage.  The first one works great.  In fact, I replaced the line  rs = C.Execute(sql) in Post with rs = C.Execute("sdnGetCallInfo '" + Request.QueryString("CallID")+ "'") from the Survey and the asp page actually display but, or course nothing records in the DB.  I attached the post.  Thanks for any advice...
Post.txt
ASKER CERTIFIED SOLUTION
Avatar of Om Prakash
Om Prakash
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Scott Fell
Your right. It is  a 2 step thing.  First you have a stored procedure in your sql database.  Then you will have asp/vb code to talk to the db/stored procedure. I like to have this as an include file as a function.

In this sample I have a SP called addNewThing in my db that accepts @newThing

<%
' include adovbs file
theID=AddNewThing("Tonka Truck")
response.write theID


Function AddNewThing(widget)

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

   	.ActiveConnection = connMyConnection
    .CommandType = adCmdStoredProc
   	.CommandText = "addNewThing" ' name of your stored procedure
   
   	.Parameters.Append .CreateParameter("@newThing",adVarWChar, adParamInput, 50)
   	.Parameters("@newThing") = widget

   set rsName = .Execute
End With

 AddNewThing= rs(0) 
 
set cmd = nothing
set rs = nothing

end Function

%>

Open in new window

Avatar of captgriggs1
captgriggs1

ASKER

This helped get me on the right path.  Thanks!