private Schedules GetScheduleExecQuery(string query) { Schedules sche = new Schedules(); using (connection = DBHelper.OpenConnection()) { MySqlCommand cmd = new MySqlCommand(query, connection); using (reader = cmd.ExecuteReader()) { if (reader.Read()) { sche = ScheduleDAL.GetSchedule(reader); } } } return(sche); }
private Schedule GetScheduleExecQuery(string query) { if (connection.State == System.Data.ConnectionState.Closed) { connection.Open(); } MySqlCommand command = new MySqlCommand(query, connection); Schedule sche = null; using (reader = command.ExecuteReader()) { while (reader.Read()) { sche = scheDAL.GetSchedule(reader); } } connection.Close(); return(sche); }