?
Solved

Cannot get SQL return message in asp website

Posted on 2012-03-21
2
Medium Priority
?
333 Views
Last Modified: 2012-08-13
We have an asp.net 4 website and an SQL 2008 database. When we call our SQL stored procedures (SPs) from our website, we gwet the table of data correctly, according to the parameters, but we sometimes do not get the text return message. It works sometimes, so there is nothing wrong with the @ReturnMessage parameter sent by the website, and it works every time from SQL MS with the same parameters. But it usually fails when called by the website - we use a breakpoint bwefore disposing of the adaptor and the @ReturnMessage parameter is null. Any ideas?
0
Comment
Question by:SageNeil
2 Comments
 
LVL 12

Accepted Solution

by:
sachitjain earned 1500 total points
ID: 37747172
I would suggest, run SQL profiler with RPC:Completed event when you access the site for transactions calling such stored procedures. SQL profiler is very easy to use. Select only RPC:Completed event in it with all columns and have correct filter for database name. Thus you would be able to capture RPC commands that are getting fired through application for transactions tested over site. This summary might help you analyze what the problem is; might be possible either of the parameters in your procedure calls are messing up somewhere.

But if you still do not figure out the difference and root cause of issue with this approach then another alternative way of getting return message in application code is through appending select @returnmessage statement at last of your stored proc. This way it won't require @returnmessage to be passed as out parameter. Moreover this statement's execution would append one more table to your dataset (at application's side) getting populated through adapter. This last table in your dataset would have only one row and one column and that would be your return message.
0
 

Author Comment

by:SageNeil
ID: 37891287
Thanks - sorry about the delay but I had not used profiler before and have only now had time to try this new approach - but it did help. The error was actually quite a simple one but it was impossible to track down until profiler showed me exactly what was being sent. Many thanks for your help
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question