Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi

Is there a way in C# to read the what would normally be the Messages in sql if running a query?

example : if I ran the query below

SQL
RESTORE DATABASE [TestDatabase] 
	FROM  DISK = N'c:\backups\TestDatabase.bak' 
	WITH  FILE = 1,  
	MOVE N'onecom_Data' TO N'D:\Databases\DATA\TestDatabase.mdf',  
	MOVE N'onecom_Log' TO N'D:\Databases\LOG\TestDatabase_1.ldf',  
	NOUNLOAD,  STATS = 1
GO


it would give me the status of the backup every percent. Can I read that data from C# as it would appear in SSMS?
Posted
Comments
[no name] 28-Mar-12 7:30am    
Not as far as I know
Erik Rude 28-Mar-12 9:09am    
In a word NO. :(

1 solution

No you can't I think it has something to do with a message pump that doesn't exist.
Not a very scientific explanation, but I did spend some hour investigating this a few years back.
 
Share this answer
 
Comments
Gordon Beeming 28-Mar-12 9:23am    
How does Microsoft do it with the SQL Toolkit, it's weird

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900