A: Использовать событие SqlConnection.InfoMessage.
private void RunProcedure() { using (SqlConnection connection = new SqlConnection(…)) { connection.InfoMessage += OnSqlConnectionInfoMessage; connection.Open(); … connection.Close(); connection.InfoMessage -= OnSqlConnectionInfoMessage; } } private void OnSqlConnectionInfoMessage(object sender, SqlInfoMessageEventArgs eventArgs) { log.InfoFormat("Message from SQL Server: {0}", eventArgs.Message); }
Комментариев нет:
Отправить комментарий