Reputation: 8816
I use ASP 3.0 on IIS 7 and SQL Server 2008 as my dbms. I have a stored procedure coded in SQL Server. I have some "Print" statements in it and also a select statement that throws out a recordset after the procedure is executed. I can retrieve the recordset by using
Set recordSet = Server.CreateObject("ADODB.RecordSet")
recordSet.Open "Execute my_procedure", dbConn
What I wish to do here is to retrieve the outputs of the "Print" statements that I am executing in the stored procedure. Please help. Thanks in advance!
Upvotes: 4
Views: 1115
Reputation: 8459
In ADO, the output from PRINT
statements is populated in the Errors
collection, so you simply have to loop through that collection:
Dim e
For Each e In dbConn.Errors
Response.Write e.Description
Next
Upvotes: 4
Reputation: 387
You can try to use the SqlInfoMessage event to trap the print statement from the connection object.
SQLConnection.InfoMessage += delegate(object sender, SqlInfoMessageEventArgs e)
{
string printresponse = e.Message;
};
You can get much more details from this link, http://www.dotnetcurry.com/ShowArticle.aspx?ID=344
Hope this helps.
Upvotes: 1