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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Do I pass values to a stored procedure without a recordset

Status
Not open for further replies.

bryant89

Programmer
Nov 23, 2000
150
CA
Does anyone know how I can pass values to a stored procedure without using a recordset. I am using asp and interdev and would like to do it using server side vb code. Any suggestions will help. Thanks in advance.

Bryant Moore
 
Hi,
u can do like this using command object.......
hope it helps

Dim Cm As New ADODB.Command

cm.CommandText = "SaveBidderImage"
cm.ActiveConnection = activeconnection
cm.CommandText = "SPName"
cm.CommandType = adCmdStoredProc

cm.Parameters.Refresh

'Set the variable values to the parameters

cm.Parameters(1).Value = value1
cm.Parameters(1).Value = value2
cm.Execute


Sunil
 
I have tried this but cannot get it to work. Is this similar to what you had or am I way off. I dont understand what some things are in your example such as
cm.CommandText = "SaveBidderImage"
cm.ActiveConnection = activeconnection
cm.CommandText = "SPName"
cm.CommandType = adCmdStoredProc


This is what I have been trying to use. I am sure its full of errors. I am not sure how to make a connection string
or whatever

dim cn,cmd
Set cn = Server.CreateObject("ADODB.Connection")
Set cmd = Server.CreateObject("ADODB.Command")
cn.Open "MCERegister"
Set cmd.ActiveConnection = cn
cmd.CommandText = "stpInsertMemberStatus"
cmd.CommandType = adCmdStoredProc
' Ask the server about the parameters for the stored proc
cmd.Parameters.Refresh
' Assign a value to the 2nd parameter.
' Index of 0 represents first parameter.
cmd.Parameters(0) = 4
cmd.Parameters(1) = 4
cmd.Parameters(2) = 4
cmd.Parameters(3) = 4

cmd.Execute
 
i think u r quite close

but u have to form ur connectionstring

which database r u using?.

Parameter collection should begin with 1 though
cmd.Parameters(1) = 4
cmd.Parameters(2) = 4
cmd.Parameters(3) = 4
cmd.Parameters(4) = 4
 
I am using sql server 2000. MCERegister is my dsn. I have no idea of how to form a connection string could you help me with this. Maybe you have an example with explanations.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top