Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql stored procedures

Status
Not open for further replies.

SeanKenney

Programmer
Dec 5, 2000
1
US
What I would like to know is how to pass VBScript variables to a sql stored procedure. As an example:
Code:
<% 
dim Name
Name = Request.Form(&quot;Name&quot;)
strSQL = &quot;exec my_proc(&quot; & Name & &quot;)&quot;

Conn.Execute(strSQL)
%>
Is this code right? Please help!
 
You need to set up a COMMAND object, and append parameters to it, then execute the command object...

I'm mixing VB and VBScript here, but I speak VB and know you are doing ASP...

So, to illustrate:

Dim cmd

cmd = Server.CreateObject(ADODB.Command)

With cmd
.ActiveConnection = conn
.CommandType = adCmdStoredProc
.CommandText = &quot;my_proc&quot;
End With

cmd.Parameters.Append cmd.CreateParameter(&quot;Name&quot;, adVarChar, adParamInput, 30, Name)

cmd.Execute

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top