ExecuteScalar alternative

F

Frank Rizzo

ExecuteScalar is great - it returns the first field of the first row.
Is there a command that returns just the return value from the stored
proc? I can't seem to find it.

Thanks
 
M

Miha Markic [MVP C#]

Hi Frank,

No, there isn't. However, returning bunch of parameter values won't hurt
performance a lot.
 
J

Joyjit Mukherjee

Hi,

after executing the command object's ExecuteNonQuery method & closing the
connection, you can retrieve any return value from the parameter you set as
Output or InputOutput in the Stored Procedure as

int recAffec;
recAffec = (int) (MyCommand.Parameters["returnvalue"].Value)

Regards
Joyjit
 

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

Top