Stored Procedure problem

  • Thread starter Thread starter The Clansman
  • Start date Start date
T

The Clansman

Hi, I have the following stored procude in a MDB database:

SELECT Id
FROM Users
WHERE Email=@Email

I want to get the return value "Id", I'm trying to use:

Dim param As New OleDbParameter("Id", OleDbType.Integer)
param.Direction = ParameterDirection.ReturnValue
cmCommand.Parameters.Add(parameterCustomerID)

but I get an error "Multiple-step OLE DB operation generated errors. Check
each OLE DB status value, if available. No work was done."

thanks,
Bruno
 
The said:
Hi, I have the following stored procude in a MDB database:

SELECT Id
FROM Users
WHERE Email=@Email

I want to get the return value "Id", I'm trying to use:

Dim param As New OleDbParameter("Id", OleDbType.Integer)
param.Direction = ParameterDirection.ReturnValue
cmCommand.Parameters.Add(parameterCustomerID)

but I get an error "Multiple-step OLE DB operation generated errors. Check
each OLE DB status value, if available. No work was done."

thanks,
Bruno

The problem is that a return value can only be a single (variable) value. If
you truly want to return a value as a parameter, then look into the SQL RETURN
command.

Your select statement may return 0, 1, or more records that satisfy the
condition, entirely depending on the underlying data.

If you just want the result(s) from your select statement, you don't need the
ReturnValue parameter, just process the resulting rows after executing the
command.
 
Back
Top