检索"输出消息"从批量SQL命令(SQL Server)的 [英] Retrieving "output messages" from batch SQL command (SQL Server)

查看:139
本文介绍了检索"输出消息"从批量SQL命令(SQL Server)的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在执行一个批次对SQL Server的几个离散查询。例如:

更新TableX的设置可乐=自由;

从客户选择的lastName;

插入tableY(A,B,C)值(x,Y,Z);

现在,我想捕捉的结果在DataSet(从select语句),这是很容易做的......但我怎么也捕获该命令的元回应的方式类似查询分析器/ SQL MGT工作室做时,它会显示信息选项卡,并diplays类似于:

(1行受影响)
(2排更新)

解决方案

考虑SQL连接事件。我认为这是你以后有什么: <一href="http://msdn.microsoft.com/en-us/library/a0hee08w.aspx">http://msdn.microsoft.com/en-us/library/a0hee08w.aspx

I'm executing several discrete queries in a single batch against SQL Server. For example:

update tableX set colA = 'freedom';

select lastName from customers;

insert into tableY (a,b,c) values (x,y,z);

Now, I want to capture the result in a DataSet (from select statement) which is easy enough to do...but how do I also capture the "meta" response from that command similar to the way Query Analyzer/SQL Mgt Studio does when it displays the "Messages" tab and diplays something similar to:

(1 Row affected)
(2 Rows Updated)

解决方案

look into SQL Connection events. I think that's what you're after: http://msdn.microsoft.com/en-us/library/a0hee08w.aspx

这篇关于检索&QUOT;输出消息&QUOT;从批量SQL命令(SQL Server)的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆