how to query a database using wpf application and get output like SQL Management Studio?
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
精彩评论