I am using this code to check my database for errors :
Dim cmd As New SqlCommand("DBCC CHECKDB (offpoDb) WITH TABLERESULTS", con)
cmd.ExecuteNonQuery()
But, u see, this command only generates SQL messages.
Is there any way to retrieve the messages in .net ?
Can i show the messages in a MessageBox ?
I've studied InfoMessage but i still fail to understand how to apply it/work with it.
Use a
SqlDataReaderinstead ofExecuteNonQueryto get the recordset returned byTABLERESULTS:To see all columns which are returned, execute the query in SQL Server Management Studio.
If you prefer to use the
InfoMessage-event then add a handler and use it like following: