Returning return codes and output params from a sproc using a sqldatasource
Posted on 2007-11-27
I have a stored proc that is sending a return code and an output parameter. I'm using a SQLDataSource to execute the proc and have been using the following code:
//handle error on return
int returnval = (int) e.Command.Parameters["@RETURN_VALUE"].Value;
//to be used later as output param
// string returnmessage = (string)e.Command.Parameters["@vcOutputMsg"].Value;
if (returnval == -1)
//lblStatus.Text = returnmessage;
lblStatus.Text = "Updated failed. Please check process log for details.";
lblStatus.ForeColor = System.Drawing.Color.Red;
lblStatus.Text = "Updated successfully";
it worked (return value only) until recently until someone changed the proc to additionally send an output param. Now, i'd like to use that output param but both return value and output param show up as null and an null exception is being thrown.
Ideas on how to do this using my existing sql datasource? Return value isn't a requirement but a nice to have.