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

Passing parameters to stored procedure using VB ADO Command object

Status
Not open for further replies.

Apocalypse

Programmer
Aug 9, 2000
3
0
0
JP
ppl,
I have the following code to pass a 8-digit ID to a stored procedure that returns all records containing that ID:
' Setup first parameter
sParmName = "Return"
Set sp_Parameter = sp_Command.CreateParameter(sParmName, adInteger, adParamReturnValue, , 0)
sp_Command.Parameters.Append sp_Parameter
sp_Command.Parameters(sParmName).Value = -1

' Setup second parameter
sParmName = "Cab_ID"
Set sp_Parameter = sp_Command.CreateParameter(sParmName, adNumeric, adParamInput)
sp_Command.Parameters.Append sp_Parameter
sp_Command.Parameters(sParmName).Value = txtWhere.Text

Set sp_RecordSet = sp_Command.Execute

Set DataGrid1.DataSource = sp_RecordSet

The problem is the parameter does not get passed to the stored procedure so it keeps returning the whole recordset.
What am I doing wrong? [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top