Displaying SQL 2008 info and error mesages on the web page

N

NeilR

We have a series of list pages on our ASP.NET 3.5 website for
displaying various searchable lists from our SQL 2008 database. The
master page for these pages has a message box for us to display
messages from the SQL stored procedures, and this works fine when we
use add, update or delete SPs, as ther only return is the message (eg
"Added as CompanyID 1234567"). However, we would like to use it for
messages that come back WITH lists too - eg to show "This person
already has the email addresses shown above. Press ADD to add another
email address". We use the sqlDataAdapter to get the list of existing
email addresses but this does not seem to enable us to get a return
infomessage from the SP. Can anyone post some code or point us to any
guidance on how to get the retrun message as well as the datalist from
the SP? I have searched SQL, ADO and ASP.NET resources but cannot find
a simple example of doing this. If you can also add a few words about
the SQL connection object InfoMessage Event it would be even more
helpful!
Many thanks, Neil
 
W

William Vaughn \(MVP\)

I'm not sure what you've tried, but the InfoMessage Event should fire when
the sp executes a PRINT statement or RAISEERROR. Note that these events do
NOT fire on the client until the TDS packets containing this feedback
arrive--and they arrive AFTER the rowset has arrived. If you have multiple
resultsets, they might not appear until after all resultsets have arrived.

See Chapter 11 pages 720-724 in my book FMI.

--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
http://betav.com http://betav.com/blog/billva
____________________________________________________________________________________________
 

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