public AppointmentSheet GetAppointmentByAppointmentId(int appointmentid) { //Please see section on using prepared statements in npgsql user manual for explanation on params and query structure Domain.AppointmentSheet newAppointment = new Domain.AppointmentSheet(); using (Npgsql.NpgsqlConnection conn = new Npgsql.NpgsqlConnection(Infrastructure.ConfigReader.ConnectionString.ToString())) { conn.Open(); using (Npgsql.NpgsqlCommand command = new Npgsql.NpgsqlCommand(AppointmentByAppointmentIdQuery, conn)) { command.Parameters.Add(new Npgsql.NpgsqlParameter("appointmentid", NpgsqlTypes.NpgsqlDbType.Integer)); command.Prepare(); command.Parameters[0].Value = appointmentid; using (Npgsql.NpgsqlDataReader dr = command.ExecuteReader()) { while (dr.Read()) { newAppointment = populateAppointmentFromDB(dr); } } } } return(newAppointment); }
public AppointmentSheet GetAppointmentByAppointmentId(int appointmentid) { //Please see section on using prepared statements in npgsql user manual for explanation on params and query structure Domain.AppointmentSheet newAppointment = new Domain.AppointmentSheet(); return(newAppointment); }