Example #1
0
 public bool updateKH(tblKhachhang kh)
 {
     using (SqlConnection cnn = dtcn.getconnect())
     {
         cnn.Open();
         try
         {
             using (SqlCommand cmd = new SqlCommand("updateKH", cnn))
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.AddWithValue("@makh", kh.Makh);
                 cmd.Parameters.AddWithValue("@tenkh", kh.tenkh);
                 cmd.Parameters.AddWithValue("@ngaysinh", kh.ngaysinh);
                 cmd.Parameters.AddWithValue("@gioitinh", kh.gioitinh);
                 cmd.Parameters.AddWithValue("@sdt", kh.sdt);
                 cmd.Parameters.AddWithValue("@diachi", kh.diachi);
                 cmd.Parameters.AddWithValue("@cmnd", kh.cmnd);
                 cmd.ExecuteNonQuery();
                 cnn.Close();
             }
         }
         catch (Exception e)
         {
             return(false);
         }
         return(true);
     }
 }
Example #2
0
        public DataTable get_ttkh(tblKhachhang kh)
        {
            DataTable data = new DataTable();

            using (SqlConnection cnn = dtcn.getconnect())
            {
                cnn.Open();
                using (SqlCommand cmd = new SqlCommand("ttKh", cnn))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@makh", kh.Makh);
                    SqlDataReader abc = cmd.ExecuteReader();
                    if (abc.HasRows)
                    {
                        data.Load(abc);
                    }
                    cnn.Close();
                    return(data);
                }
            }
        }