A
Ant
Hi,
I'm tring to use the event handler in the statement completed event of a
command object to retrieve the value of the output parameter passed from the
SP.
When I try to do this, I get an 'Object referece not set to an instance of
an object'
What is going wrong here? Isn't sender the Command object? Shouldn't it have
a collection of the parameters & the value of the output param?
Below is what I'm trying to so in the event handler. I've broken up the
instantiation of the command obj to make it simpler.
void commandBackup_StatementCompleted(object sender,
StatementCompletedEventArgs e)
{
// cast the sender obj to a command obj
SqlCommand commandResult = ((SqlCommand)sender);
// get the value of the output parm
string resultString =
commandResult.Parameters["@ResultString"].Value.ToString();
// display the value
textboxCompleted.Text = resultString;
}
many thanks for any help anyone can provide
Ant
I'm tring to use the event handler in the statement completed event of a
command object to retrieve the value of the output parameter passed from the
SP.
When I try to do this, I get an 'Object referece not set to an instance of
an object'
What is going wrong here? Isn't sender the Command object? Shouldn't it have
a collection of the parameters & the value of the output param?
Below is what I'm trying to so in the event handler. I've broken up the
instantiation of the command obj to make it simpler.
void commandBackup_StatementCompleted(object sender,
StatementCompletedEventArgs e)
{
// cast the sender obj to a command obj
SqlCommand commandResult = ((SqlCommand)sender);
// get the value of the output parm
string resultString =
commandResult.Parameters["@ResultString"].Value.ToString();
// display the value
textboxCompleted.Text = resultString;
}
many thanks for any help anyone can provide
Ant