public int ExecuteNonQuery(SqlCommand command) { object ReturnResult; SqlDataAdapter da = new SqlDataAdapter(); DataTable dt = new DataTable(); SQLConnect.ConnectionString = ConnectionString; command.Connection = SQLConnect; if (!UseTransaction) { if (SQLConnect.State == ConnectionState.Open) { SQLConnect.Close(); } SQLConnect.Open(); } try { ReturnResult = (object)command.ExecuteNonQuery(); } catch { ReturnResult = -1; if (!UseTransaction) { this.RollbackTransaction(); } } finally { if (!UseTransaction) { SQLConnect.Close(); } } return(int.Parse(ReturnResult.ToString())); }