473,738 Members | 3,854 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 + InfoMessageEven tArgs

And if there is a better ng than here to post this, please let me know...
Nov 18 '05 #1
2 2292
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*******@disc ussions.microso ft.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 + InfoMessageEven tArgs?

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*******@disc ussions.microso ft.com> wrote in message
news:4C******** *************** ***********@mic rosoft.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 +
InfoMessageEven tArgs?
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
9491
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 the output parameters, but will I be able to retrieve the recordset using the Command object as well? Or do I have to use the Recordset object? Example of stored procedure:
2
3167
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 script is printed below: <?php system('main.exe');
3
9763
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() or is there a better solution? Thanks, Justin.
6
2268
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
5725
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), would 2 execute statements be needed to return the OUTPUT parameter? Like this? adocmd.CommandTimeout = 120 adocmd.ActiveConnection = conn
0
2072
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 from database to a VB.net app, they retrieve the database fields as a record set eg. "select name, suburb from myTable"
3
2851
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 time. Now the identity value is over 700.000 and I get errors whiles retrieving the inserted identitiy value. If I delete rows and reset the identity everything works well again. So I think it is a data type problem. My Procedure:
4
18817
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 without any details. Can anyone please help me.. Im stuck on it since 2 days Thanks Stored Procedure
2
1669
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 1:48:06 PM |
4
2942
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 is. This is for a graphics application, by the way. I'm using Turbo c++.
0
8968
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8787
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9473
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9334
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9259
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8208
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6750
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4569
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

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.