473,586 Members | 2,863 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3123
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.c om> wrote in message
news:3f******** *************@l ovejoy.zen.co.u k...
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************* *@exisconsultin g.com

"Dimitris" <sp**@hotmail.c om> wrote in message
news:3f******** *************@l ovejoy.zen.co.u k...
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.co m, I would appreciate it.

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

"Dimitris" <sp**@hotmail.c om> wrote in message
news:3f******** *************@l ovejoy.zen.co.u k...
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
1713
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 am trying to incorporate the resulting HTML into a layout I have created in order to keep the look & feel of my site consistent, but the resulting...
6
2559
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 "/x/", or is the former a better way of including a literal substring within an expression? I know there must be a valid reason for including them,...
3
4956
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 tons of examples of capturing keys in IE but *none* of them work for capturing Ctrl+S, Ctrl+F, Ctrl+P,etc or any key combination that has a binding...
4
11991
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 problem in Firefox, not IE. I do know it's possible because Blogger.com's rich text editor does it, but their code is cryptic and separated into like 20...
33
5589
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 p.pattern.groups > 100: raise AssertionError( "sorry, but this version only supports 100 named groups"
5
2429
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 functions, then drop and recreate the user defined functions, then recreate all the views and triggers. I don't imiagine I'm the first person who needed...
14
2528
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 internet, they have to login. I want to be able to capture that login versus their Windows login because I need to know who they are from any computer...
5
4726
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 gets triggered and the double click is not identified at all. Is there any way I can invoke the double click when the mouse move also exists?
2
2687
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 the web and found some information on writing such a software with the help of the DirectShow library of DirectX9. But as it was all in C++ and as I'm...
6
2258
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 PC, but has a significant number of Macs running OS X, too. Googling around quickly turns up IM Grabber for the PC, which would seem to be just...
0
7839
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...
0
8338
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...
1
7954
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...
0
8215
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5390
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...
0
3864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1448
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1179
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.