English 中文(简体)
ADO中检索数据库信息(例如“Print”声明产出,但不错误信息)
原标题:Retrieve database messages (e.g., "Print" statement outputs but not error messages) in ADO

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 RecordsSet = 服务器.CreateObject(“ADODB.RecordSet”)

页: 1

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!

最佳回答

在ADO中,在 Errors的收集中,都有以下数据:

Dim e
For Each e In dbConn.Errors
    Response.Write e.Description
Next
问题回答

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

希望这一帮助。





相关问题
Performance impact of indexed view in MS SQL Server 2008

Does anyone have experience with using indexed view in MS SQL Server 2008? I am trying to find out how does indexed view affect performance of insert / update statements, that are adding / updating ...

Lock Escalation - What s happening here?

While altering a table (removing a column) in SQL Server 2008, I clicked the Generate Change Script button and I noticed that the change script it generated drops the column, says "go" and then runs ...

Round to nearest 5 in SQL Server

I have a Money column in my SQL Server 2008 table. In my below query how can I round it to nearest 5$ select FineAmount from tickets Thanks

热门标签