ExecuteScalar alternative

  • Thread starter Thread starter Frank Rizzo
  • Start date Start date
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
 
Hi Frank,

No, there isn't. However, returning bunch of parameter values won't hurt
performance a lot.
 
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
 
Back
Top