Stored Procedure problem

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
 
J

Julie

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top