Ly try this:
SqlConnection connection = new SqlConnection("server=.;database=Northwind;integrated Security=SSPI;");
connection .InfoMessage += new SqlInfoMessageEventHandler(InfoMessageHandler);
static void InfoMessageHandler(object sender, SqlInfoMessageEventArgs e)
{
string myMsg = e.Message;
}
The "e.Message" is the message printed out to the message window in SQL Server Management Studio.