Retrieving text printed in a stored procedure

  • Thread starter Thread starter Jan Löhndorf
  • Start date Start date
J

Jan Löhndorf

Hi.
Is it possible to retrieve the text I printed in a stored procedure
using PRINT command when using C# SqlDataReader?

Any idea?

Thanks for every hint,
Jan
 
Not from the reader; but you can get it from the connection by
subscribing to the InfoMessage event.

Marc
 
After serious thinking Jan Löhndorf wrote :
Hi.
Is it possible to retrieve the text I printed in a stored procedure using
PRINT command when using C# SqlDataReader?

Any idea?

Thanks for every hint,
Jan

Yes, the SqlConnection object has a InfoMessage event. Hook an handler
to that event. The SqlInfoMessageEventArgs that you receive has an
Errors collection, where the Message contains the "print"ed text.

Hans Kesting
 
Hans said:
Yes, the SqlConnection object has a InfoMessage event. Hook an handler
to that event. The SqlInfoMessageEventArgs that you receive has an
Errors collection, where the Message contains the "print"ed text.


Muy bien. Gracias ;-)

Jan
 
Back
Top