Retrieving text printed in a stored procedure

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
 
M

Marc Gravell

Not from the reader; but you can get it from the connection by
subscribing to the InfoMessage event.

Marc
 
H

Hans Kesting

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
 
J

Jan Löhndorf

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top