Capturing info messages and result set from a stored proc

D

ddangerous

Hi,

I'm looking for a way to get both the result set and PRINT messages
from a stored proc.

Currently if i use ExecuteNonQuery i get the infomessage event firing,
and if I use a sqldataadapter to fill a dataset i get the result set
but no infomessage. Is there a way to get both without calling the
stored proc twice?

Cheers,

David Newman
 
R

Robbe Morris [C# MVP]

Interesting question. Not sure I've ever heard of someone wanting that.
What would you want both for?
 
D

ddangerous

I have a page that executes a lot of different stored procedures,
mostly for db updating. Every query returns informational messages
which get passed on to the user letting them know that everything
functioned correctly.

Some queries do an update but find a few gaps in the data and so return
a table which i render as a datagrid and the user can make changes to
the database. This all works well except for not being able to get
messages.

I could change the procedure to call a different stored proc for the
result set but I was just wondering if I have to.

Also query analyzer manages to get both...
 
C

Chad Z. Hower aka Kudzu

(e-mail address removed) wrote in @g49g2000cwa.googlegroups.com:
Some queries do an update but find a few gaps in the data and so return
a table which i render as a datagrid and the user can make changes to
the database. This all works well except for not being able to get
messages.

I could change the procedure to call a different stored proc for the
result set but I was just wondering if I have to.

Also query analyzer manages to get both...

While it may be possible, doing any such thing from a stored procedure is a
very bad idea architecturally. If you are in a bind and cannot control the
architecture, you may look at getting the SP to post a message via MSMQ,
sockets, webservice, whatever to another process to then do the actual
printing.
 

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