开发者

how to query a database using wpf application and get output like SQL Management Studio?

开发者 https://www.devze.com 2023-03-28 22:51 出处:网络
I have one store procedure in my database, it makes many things and print results when i run it on sqlserver management studio (ssms), for example:

I have one store procedure in my database, it makes many things and print results when i run it on sqlserver management studio (ssms), for example:

exporting table abc... exporting table def... deleting table temp...

My program has to run the store procedure and show the output anywhere (maybe creating a log file), such as ssms does (it shows output in the messages ta开发者_运维百科b). I have to show exactly the same ssms shows. How can I do this?? sqlcmd, ado.net?? I see this question

How to run sql from a .net application against sqlserver and get output like with SQL Management Studio?

but, answer is not clear... Help!!


If you want to capture warning and information messages, you will want to create a SqlInfoMessageEventHandler delegate to handle the SqlConnection.InfoMessage event. See references below for details.

http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.infomessage.aspx http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlinfomessageeventhandler.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号