public void addRoom(Phong p) { ketnoi(); cmd = new SqlCommand("INSERT INTO tblPhong VALUES(@SoPhong,@LoaiPhong,0)", conn); cmd.Parameters.AddWithValue("SoPhong", p.SoPhong); cmd.Parameters.AddWithValue("LoaiPhong", p.LoaiPhong); cmd.ExecuteNonQuery(); dongketnoi(); }
public void editRoom(string SoPhong, Phong p) { ketnoi(); cmd = new SqlCommand("UPDATE tblPhong SET SoPhong=@SoPhong,LoaiPhong=@LoaiPhong WHERE SoPhong = @n", conn); cmd.Parameters.AddWithValue("SoPhong", p.SoPhong); cmd.Parameters.AddWithValue("LoaiPhong", p.LoaiPhong); cmd.Parameters.AddWithValue("n", SoPhong); cmd.ExecuteNonQuery(); dongketnoi(); }