I dont know of a way to do this in V1.1. There could be additional
functionality available in SQL Server to do this which I am not aware of.
In V2.0 (Which is currently in Beta), you get the messages prinited by PRINT
using the InfoMessage Event. Here is a code snippet, (its in c# though
)
<Code>
using System.Data;
using System;
using System.Data.SqlClient;
public class Repro {
public static int Main(string[] args) {
SqlConnection sqlconnection1 = new
SqlConnection("ConnectionStringHERE");
sqlconnection1.InfoMessage += new
SqlInfoMessageEventHandler(SqlConnection_OnInfoMessage);
sqlconnection1.Open();
SqlCommand sqlcommand1 = sqlconnection1.CreateCommand();
sqlcommand1.CommandText = "PRINT 'TEST123'";
Int32 int321 = sqlcommand1.ExecuteNonQuery(); // -1
return 1;
}
public static void SqlConnection_OnInfoMessage(Object sender,
SqlInfoMessageEventArgs e) {
Console.WriteLine("InfoMessage Event: " + sender + ", " + e);
}
</code>
<output>
InfoMessage Event: System.Data.SqlClient.SqlConnection, TEST123
</output>
HTH,
Sushil.
Disclaimer
osting is provided "AS IS" with no warranties, and confers no
rights.