473,407 Members | 2,314 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,407 software developers and data experts.

Capturing the plain-text output of a stored procedure

I'm using ADO.NET to call a stored procedure that runs the "BACKUP" command
on selected databases. Is there any way I can capture the text output of the
stored proc and return it to ADO.NET for displaying in my application?

When I run the stored procedure from SQL Query Analyzer, I get an output (in
the messages tab) like:

Processed 1496 pages for database 'OldBO', file 'TB_BackOffice_Data' on file
1.
Processed 1 pages for database 'OldBO', file 'TB_BackOffice_Log' on file 1.
BACKUP DATABASE successfully processed 1497 pages in 1.909 seconds (6.420
MB/sec).
Processed 120 pages for database 'Profile', file 'Profile_Data' on file 1.
Processed 1 pages for database 'Profile', file 'Profile_Log' on file 1.
BACKUP DATABASE successfully processed 121 pages in 0.293 seconds (3.358
MB/sec).
Processed 104 pages for database 'Quotes', file 'Quotes_Data' on file 1.
Processed 1 pages for database 'Quotes', file 'Quotes_Log' on file 1.

etc...

This is the information I'd like to capture (plus any other messages that my
be created from "PRINT" statements within the sp).

Thanks,
Dimitris
Jul 19 '05 #1
3 3107
Informational messages can be retrieved by handling the your connection
object InfoMessage event. This includes PRINT and RAISERROR statements
(severity < 11).

--
Hope this helps.

Dan Guzman
SQL Server MVP

-----------------------
SQL FAQ links (courtesy Neil Pike):

http://www.ntfaq.com/Articles/Index....partmentID=800
http://www.sqlserverfaq.com
http://www.mssqlserver.com/faq
-----------------------

"Dimitris" <sp**@hotmail.com> wrote in message
news:3f*********************@lovejoy.zen.co.uk...
I'm using ADO.NET to call a stored procedure that runs the "BACKUP" command on selected databases. Is there any way I can capture the text output of the stored proc and return it to ADO.NET for displaying in my application?

When I run the stored procedure from SQL Query Analyzer, I get an output (in the messages tab) like:

Processed 1496 pages for database 'OldBO', file 'TB_BackOffice_Data' on file 1.
Processed 1 pages for database 'OldBO', file 'TB_BackOffice_Log' on file 1. BACKUP DATABASE successfully processed 1497 pages in 1.909 seconds (6.420 MB/sec).
Processed 120 pages for database 'Profile', file 'Profile_Data' on file 1. Processed 1 pages for database 'Profile', file 'Profile_Log' on file 1. BACKUP DATABASE successfully processed 121 pages in 0.293 seconds (3.358 MB/sec).
Processed 104 pages for database 'Quotes', file 'Quotes_Data' on file 1. Processed 1 pages for database 'Quotes', file 'Quotes_Log' on file 1.

etc...

This is the information I'd like to capture (plus any other messages that my be created from "PRINT" statements within the sp).

Thanks,
Dimitris

Jul 19 '05 #2
Dimitris,

What I think you want to do is get the connection for the server. Once
you have the instance of the SqlConnection, you can hook up to the
InfoMessage event, which ^should^ be fired when there is message information
sent with the resultset.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Dimitris" <sp**@hotmail.com> wrote in message
news:3f*********************@lovejoy.zen.co.uk...
I'm using ADO.NET to call a stored procedure that runs the "BACKUP" command on selected databases. Is there any way I can capture the text output of the stored proc and return it to ADO.NET for displaying in my application?

When I run the stored procedure from SQL Query Analyzer, I get an output (in the messages tab) like:

Processed 1496 pages for database 'OldBO', file 'TB_BackOffice_Data' on file 1.
Processed 1 pages for database 'OldBO', file 'TB_BackOffice_Log' on file 1. BACKUP DATABASE successfully processed 1497 pages in 1.909 seconds (6.420
MB/sec).
Processed 120 pages for database 'Profile', file 'Profile_Data' on file 1.
Processed 1 pages for database 'Profile', file 'Profile_Log' on file 1.
BACKUP DATABASE successfully processed 121 pages in 0.293 seconds (3.358
MB/sec).
Processed 104 pages for database 'Quotes', file 'Quotes_Data' on file 1.
Processed 1 pages for database 'Quotes', file 'Quotes_Log' on file 1.

etc...

This is the information I'd like to capture (plus any other messages that my be created from "PRINT" statements within the sp).

Thanks,
Dimitris

Jul 19 '05 #3
Also, if you could not set the reply address to valid address that is
not yours (such as) sp**@hotmail.com, I would appreciate it.

--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Dimitris" <sp**@hotmail.com> wrote in message
news:3f*********************@lovejoy.zen.co.uk...
I'm using ADO.NET to call a stored procedure that runs the "BACKUP" command on selected databases. Is there any way I can capture the text output of the stored proc and return it to ADO.NET for displaying in my application?

When I run the stored procedure from SQL Query Analyzer, I get an output (in the messages tab) like:

Processed 1496 pages for database 'OldBO', file 'TB_BackOffice_Data' on file 1.
Processed 1 pages for database 'OldBO', file 'TB_BackOffice_Log' on file 1. BACKUP DATABASE successfully processed 1497 pages in 1.909 seconds (6.420
MB/sec).
Processed 120 pages for database 'Profile', file 'Profile_Data' on file 1.
Processed 1 pages for database 'Profile', file 'Profile_Log' on file 1.
BACKUP DATABASE successfully processed 121 pages in 0.293 seconds (3.358
MB/sec).
Processed 104 pages for database 'Quotes', file 'Quotes_Data' on file 1.
Processed 1 pages for database 'Quotes', file 'Quotes_Log' on file 1.

etc...

This is the information I'd like to capture (plus any other messages that my be created from "PRINT" statements within the sp).

Thanks,
Dimitris

Jul 19 '05 #4

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

Similar topics

2
by: Dan | last post by:
A Newbie needs help! Is it possible, in PHP, to capture the resulting HTML of a submitted form returning from a server and incorporate that HTML into say a table, or some predefined layout? I...
6
by: Michael Winter | last post by:
I'll be frank: what is the point? The use, and usefulness, of a set of capturing parentheses in a regular expression is clear. However, isn't an expression such as "/(?:x)/", exactly the same as...
3
by: Greg | last post by:
I want to be able to capture the user pressing Ctrl+S. I know that the IE browser has a key binding for Ctrl+S but is there any way that I can be notified of this key press anyway. I have found...
4
by: Jay Xx | last post by:
I have an IFrame in design mode. I've tried a bunch of things to capture key presses in that IFrame, but I can't seem to get it. I can capture key presses outside the IFrame fine. I have this...
33
by: Joerg Schuster | last post by:
Hello, Python regular expressions must not have more than 100 capturing groups. The source code responsible for this reads as follows: # XXX: <fl> get rid of this limitation! if...
5
by: Bruce | last post by:
I have several user defined functions which are referenced in triggers and views. For software upgrades, I need to be able to drop the triggers and views which reference these user defined...
14
by: Brent Burkart | last post by:
I am trying to capture the Windows Authenticated username, but I want to be able to capture the login name that exists in IIS, not Windows. In order to enter my company's intranet through the...
5
by: Nick | last post by:
Hey guys, I have 2 events on a windows forms datagrid, the mouse move as well as the double click events. What's happening is that when I double click on a row in the grid, the mouse move event...
2
by: Stampede | last post by:
Hi guys & girls, I would like to write some kind of "Head-Tracking-Software", which uses a WebCam to react to the movement of the head of the person sitting in front of the monitor. I searched...
6
by: Ed Leafe | last post by:
I've been approached by a local business that has been advised that they need to start capturing and archiving their instant messaging in order to comply with Sarbanes-Oxley. The company is largely...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
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
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,...
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.