C#SQL Server备份%的阅读

问题描述:

SQL命令

BACKUP DATABASE [databasesample] TO  DISK = N'D:\kkk\test.bat' WITH  INIT ,  NOUNLOAD , 
NAME = N'name test',  NOSKIP ,  
STATS = 5,  DESCRIPTION = N'test',  NOFORMAT 

结果

5 percent processed.
10 percent processed.
15 percent processed.
20 percent processed.
25 percent processed.
30 percent processed.
35 percent processed.
40 percent processed.
45 percent processed.
50 percent processed.
55 percent processed.
60 percent processed.
65 percent processed.
70 percent processed.
75 percent processed.
80 percent processed.
85 percent processed.
90 percent processed.
95 percent processed.
Processed 30960 pages for database 'databasesample', file 'sample_Data' on file 1.
100 percent processed.

我要赶在C#的百分比。我觉得 BeginExecuteNonQuery的()函数完成。但我不知道究竟如何。建议?

I want to catch the percentage with C#. I think BeginExecuteNonQuery() function is done. but I do not know exactly how. Suggestions?

另外,从使用SMO方法等已表示,或潜入的 PERCENT_COMPLETE 列HREF =htt​​p://msdn.microsoft.com/en-us/library/ms177648.aspx相对=nofollow> sys.dm_exec_requests视图 ,还有在这里问了另一个问题:怎么我捕捉那些 5%的完整在C#中的消息

Besides from using the SMO method as other have indicated, or from sneaking the percent_complete column of sys.dm_exec_requests, there is also another question asked here: how to I capture those 5 percent complete messages in C#?

完成百分比是提示性消息。在C#中的所有信息消息可以从 SqlConnection.InfoMessage $ 事件。

The percent complete is an informational message. All informational messages in C# can be captured from the SqlConnection.InfoMessage event.