How do you get a guid back from command.ExecuteScalar and then use it for next proc?
Posted on 2003-03-23
I have a SqlCommand object that executes a stored procedure to create a record and return the guid of the newly created record. I need that new guid for executing the next proc.
I am trying to get command.ExecuteScalar to work, but no matter what I do--and I've tried a million different things-- I get some kind of casting error.
What do I need to do to cast this object so that I can pass this return value to my next proc? I assuming that I need to cast it as a guid, since that's what the proc will be expecting.
Here's an example of code that's not working:
> String strNewID= objSubmitForm.ExecuteScalar().ToString();