public DataSet getRows(AppointmentDTO a) { c.sqlConn.Open(); string query = "select * from Appointment where Name='" + a.Name + "' and Date='" + a.Date + "'"; c.sqlComm = new SqlCommand(query, c.sqlConn); c.sqlAdap = new SqlDataAdapter(c.sqlComm); c.dataSet = new DataSet(); c.sqlAdap.Fill(c.dataSet); c.sqlConn.Close(); return(c.dataSet); }
public bool updateAppointment(AppointmentDTO a) { c.sqlConn.Open(); string query = "update Appointment set date='" + a.Date + "', time='" + a.Time + "', name='" + a.Name + "' where appointmentID=" + a.AppointmentId; try { c.sqlComm = new SqlCommand(query, c.sqlConn); c.sqlComm.ExecuteNonQuery(); c.sqlConn.Close(); return(true); } catch (Exception e) { c.sqlConn.Close(); return(false); } }
public bool getApp(AppointmentDTO a) { c.sqlConn.Open(); string query = "update Appointment set id=" + a.Id + " where Name='" + a.Name + "' and Date='" + a.Date + "' and time='" + a.Time + "'"; try { c.sqlComm = new SqlCommand(query, c.sqlConn); c.sqlComm.ExecuteNonQuery(); c.sqlConn.Close(); return(true); } catch (Exception e) { c.sqlConn.Close(); return(false); } }