コード例 #1
0
 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);
 }
コード例 #2
0
        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);
        }
コード例 #3
0
 public bool UpdData(ClassKhachhang kh)
 {
     return(khMod.UpdateData(kh));
 }
コード例 #4
0
 public bool AddData(ClassKhachhang kh)
 {
     return(khMod.AddData(kh));
 }