473,405 Members | 2,349 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Retrieving SQL output

jb
Using ADO.NET from ASP.NET. Have a SqlConnection executing stuff (stored procedures)

I would like to be able to retrieve informational messages from the SQL sps, which comment on what they are doing (updating tables etc.), and show them to the user/write them to a file. Is there any way I can get at anything that comes from a SQL PRINT statement in this context? osql utility lets this go to standard output, which can be captured; that's the sort of thing I have in mind, but I suspect it may go into the blue nowhere from ADO.NET. Or is my best/only solution to rewrite messages via RAISERROR <severity-level-less-than-10>, and catch in code via InfoMessage event + InfoMessageEventArgs

And if there is a better ng than here to post this, please let me know...
Nov 18 '05 #1
2 2273
Informational messages include PRINT and RAISEERROR (severity < 11)
statements - they won't just go into the blue nowhere but show up in
the InfoMessage event handler.

Just be aware that the events won't start firing until after the batch
has completed.

--
Scott
http://www.OdeToCode.com

On Tue, 13 Apr 2004 05:16:02 -0700, "jb"
<an*******@discussions.microsoft.com> wrote:
Using ADO.NET from ASP.NET. Have a SqlConnection executing stuff (stored procedures).

I would like to be able to retrieve informational messages from the SQL sps, which comment on what they are doing (updating tables etc.), and show them to the user/write them to a file. Is there any way I can get at anything that comes from a SQL PRINT statement in this context? osql utility lets this go to standard output, which can be captured; that's the sort of thing I have in mind, but I suspect it may go into the blue nowhere from ADO.NET. Or is my best/only solution to rewrite messages via RAISERROR <severity-level-less-than-10>, and catch in code via InfoMessage event + InfoMessageEventArgs?

And if there is a better ng than here to post this, please let me know...


Nov 18 '05 #2
Any information you want from the Stored Procedure can be returned as an
output parameter.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"jb" <an*******@discussions.microsoft.com> wrote in message
news:4C**********************************@microsof t.com...
Using ADO.NET from ASP.NET. Have a SqlConnection executing stuff (stored procedures).
I would like to be able to retrieve informational messages from the SQL sps, which comment on what they are doing (updating tables etc.), and show
them to the user/write them to a file. Is there any way I can get at
anything that comes from a SQL PRINT statement in this context? osql
utility lets this go to standard output, which can be captured; that's the
sort of thing I have in mind, but I suspect it may go into the blue nowhere
from ADO.NET. Or is my best/only solution to rewrite messages via RAISERROR
<severity-level-less-than-10>, and catch in code via InfoMessage event +
InfoMessageEventArgs?
And if there is a better ng than here to post this, please let me know...

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: PinkGuava | last post by:
Hi, I have a T-SQL stored procedure that returns both output parameters and a recordset. How do I retrieve them in my ASP script? As far as I know, the ADO Command object can be used to retrieve...
2
by: Ben Chivers | last post by:
I have a problem, which I think can be easily solved somehow. I am trying to execute a C program through using a PHP script. I do this by sending an exec command from the PHP script. My PHP...
3
by: Justin | last post by:
I have created a dataset with two tables and an insert command, I need to be able to retreive the Key Identity after inserting into table "A" for use in table "B". Should I use ExecuteScalar()...
6
by: Stu Lock | last post by:
Hi, I have a stored procedure: --/ snip /-- CREATE PROCEDURE sp_AddEditUsers ( @Users_ID int, @UserName nvarchar(80), @Password nvarchar(80),
1
by: stjulian | last post by:
If inside a stored procedure, there a SELECT statement to return a recordset and another SELECT to set the value of an output parameter (as in SELECT @OutValue = Name FROM table WHERE pkid=5),...
0
by: Andy | last post by:
Hi All. I'm working for a company that has set out a guideline for retrieving data from a database. Nobody can explain to me the reason for the following. When retrieving a set of records...
3
by: Susanne Klemm | last post by:
Hello! I use a procedure to insert a new row into a table with an identity column. The procedure has an output parameter which gives me the inserted identity value. This worked well for a long...
4
by: smartin | last post by:
Hi, I'm having problem retrieving data from an SQL stored procedure. I tried debugging but it wont give a the reason for the error. it just throws an exception after executing cmd.ExecuteNonQuery...
2
by: =?Utf-8?B?U2FpbXZw?= | last post by:
Hi and Hello. Good Day. I have a problem in retrieving time in database. I have Table name "SAMPLE" and have field name "DATES" DATES -------------------------------------| 5/9/2008...
4
by: DiffThinkr | last post by:
Hi, Is there anyway of saving and retrieving the output screen. I don't want to use the saved file outside the program but I need to be able to put the output that I saved back into output as it...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.