Lektion 15: lösningsförslag
- Brad Pitt' OR 'a' = 'a
- SELECT PatientID, Date, Doctor
- FROM Appointment
- WHERE PatientID = '8502101234' AND Doctor = 'Brad Pitt' OR 'a' = 'a'
- 12 OR 1 = 1
- SELECT PatientID, DatePrescribed, Medicine
- FROM Prescription
- WHERE PatientID = '8502101234' AND DATEDIFF(month, DatePrescribed, GETDATE()) <= 12 OR 1 = 1
- string sql = @"
- SELECT PatientID, Date, Doctor
- FROM Appointment
- WHERE PatientID = @Id AND Doctor = @Doctor";
- SqlCommand command = new SqlCommand(sql, connection);
- command.Parameters.Add(new SqlParameter("@Id", id));
- command.Parameters.Add(new SqlParameter("@Doctor", doctor));