private static DataTable GetAllServiceInstances(string query) { DataTable dt = new DataTable(); using (SqlConnection conn = new SqlConnection(String.Format(Constants._DB_CONN_STRING, GlobalProperties.DatabaseServer, MSBTS_MsgBoxSetting.GetDatabaseName()))) { using (SqlCommand command = new SqlCommand(query, conn)) { command.Connection.Open(); SqlDataAdapter dataAdapter = new SqlDataAdapter(command); dataAdapter.Fill(dt); } } return(dt); }
private static bool HasInProgressInstanceSQLQuery(string query, out int numberOfInstances) { bool retValue = false; using (SqlConnection conn = new SqlConnection(String.Format(Constants._DB_CONN_STRING, GlobalProperties.DatabaseServer, MSBTS_MsgBoxSetting.GetDatabaseName()))) { using (SqlCommand command = new SqlCommand(query, conn)) { command.Connection.Open(); numberOfInstances = (int)command.ExecuteScalar(); if (numberOfInstances > 0) { retValue = true; } } } return(retValue); }