diff --git a/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/Query.cs b/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/Query.cs index 292b1e81..887bbbaf 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/Query.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/Query.cs @@ -34,6 +34,9 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution /// public ConnectionInfo EditorConnection { get; set; } + /// + /// Whether or not the query has an error + /// public bool HasError { get; set; } /// @@ -120,7 +123,6 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution using (conn = EditorConnection.Factory.CreateSqlConnection(connectionString)) { // If we have the message listener, bind to it - // TODO: This doesn't allow testing via mocking SqlConnection sqlConn = conn as SqlConnection; if (sqlConn != null) { @@ -141,7 +143,10 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution do { // Create a message with the number of affected rows - ResultMessages.Add(String.Format("({0} row(s) affected)", reader.RecordsAffected)); + if (reader.RecordsAffected >= 0) + { + ResultMessages.Add(String.Format("({0} row(s) affected)", reader.RecordsAffected)); + } if (!reader.HasRows && reader.FieldCount == 0) {