Ejemplo n.º 1
0
        public void UpdateHocSinh(HOCSINHDTO hs)
        {
            string query = string.Format("UPDATE HOCSINH set TenHocSinh = N'{0}', " +
                                         "NgaySinh = '{1}', DiaChi = N'{2}', " +
                                         "Email = '{3}', GioiTinh = N'{4}' " +
                                         "WHERE MaHocSinh = '{5}'", hs.TenHocSinh, hs.NgaySinh, hs.DiaChi, hs.Email, hs.GioiTinh, hs.MaHocSinh);

            SqlProvider.ExecuteNoneQuery(query);
        }
Ejemplo n.º 2
0
        public void InsertHocSinh(HOCSINHDTO hs)
        {
            string prefix = "HS100";
            int    n      = int.Parse(hs.MaHocSinh.Substring(5));

            while (CheckIDisUse(hs.MaHocSinh))
            {
                n++;
                hs.MaHocSinh = string.Format("{0}{1}", prefix, n);
            }
            string query = "INSERT INTO HOCSINH(MaHocSinh, TenHocSinh, GioiTinh, NgaySinh, DiaChi, Email) VALUES (N'" + hs.MaHocSinh + "',N'" + hs.TenHocSinh + "',N'" + hs.GioiTinh + "',N'" + hs.NgaySinh + "',N'" + hs.DiaChi + "',N'" + hs.Email + "')";

            SqlProvider.ExecuteNoneQuery(query);
        }