public bool UpdateData(ClassKhachhang kh) { cmd.CommandText = "update tb_KH set TenKH= N'" + kh.Ten + "',GioiTinh=N'" + kh.Gioitinh + "',DiaChi=N'" + kh.Diachi + "',SDT='" + kh.Sdt + "' where MaKH='" + kh.Ma + "'"; cmd.CommandType = CommandType.Text; cmd.Connection = con.Connection; try { con.OpenConn(); cmd.ExecuteNonQuery(); con.CloseConn(); return(true); } catch (Exception ex) { string mex = ex.Message; cmd.Dispose(); con.CloseConn(); } return(false); }
public bool AddData(ClassKhachhang kh) { DataTable dt = new DataTable(); cmd.CommandText = "insert into tb_KH values ('" + kh.Ma + "',N'" + kh.Ten + "',N'" + kh.Gioitinh + "',N'" + kh.Diachi + "','" + kh.Sdt + "')"; cmd.CommandType = CommandType.Text; cmd.Connection = con.Connection; try { con.OpenConn(); cmd.ExecuteNonQuery(); con.CloseConn(); return(true); } catch (Exception ex) { string mex = ex.Message; cmd.Dispose(); con.CloseConn(); } return(false); }
public bool UpdData(ClassKhachhang kh) { return(khMod.UpdateData(kh)); }
public bool AddData(ClassKhachhang kh) { return(khMod.AddData(kh)); }