public void Update(Lecs lecturers) { using (var connection = factory.CreateConnection()) { connection.ConnectionString = connectionString; connection.Open(); var command = factory.CreateCommand(); command.Connection = connection; command.CommandText = $"Update Lecs set Lecturer_name ='{lecturers.Lecturer_name}',Faculty ='{lecturers.Faculty}',Department ='{lecturers.Department}',Building ='{lecturers.Building}',Lvl ='{lecturers.Level}',Rank='{lecturers.Rank}' where Lecturer_ID = {lecturers.Lecturer_ID};"; command.ExecuteNonQuery(); } }
public void Add(Lecs lecturers) { using (var connection = factory.CreateConnection()) { connection.ConnectionString = connectionString; connection.Open(); var command = factory.CreateCommand(); command.Connection = connection; command.CommandText = $"Insert into Lecs(Lecturer_name,Faculty,Department,Building,Lvl,Rank) Values('{lecturers.Lecturer_name}','{lecturers.Faculty}','{lecturers.Department}','{lecturers.Building}','{lecturers.Level}','{lecturers.Rank}');"; command.ExecuteNonQuery(); } }