예제 #1
0
        public string InsertSanPham(EC_SANPHAM et)
        {
            string        sql = "ThemSP";
            SqlConnection con = new SqlConnection(KetNoiDB.getconnect());

            con.Open();
            SqlCommand cmd = new SqlCommand(sql, con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@tensp", et.TenSP);
            cmd.Parameters.AddWithValue("@malh", et.MaLH);
            cmd.Parameters.AddWithValue("@soluong", et.SoLuong);
            cmd.Parameters.AddWithValue("@loinhuan", et.LoiNhuan);
            cmd.Parameters.AddWithValue("@gianhap", et.GiaNhap);
            cmd.Parameters.AddWithValue("@mota", et.MoTa);
            cmd.Parameters.AddWithValue("@nsx", et.NSX);
            cmd.Parameters.AddWithValue("@hinhanh", et.HinhAnh);

            DataTable      dt = new DataTable();
            SqlDataAdapter ad = new SqlDataAdapter(cmd);

            ad.Fill(dt);
            string ma = dt.Rows[0].ItemArray[0].ToString();

            cmd.Dispose();
            con.Close();
            return(ma);
        }
예제 #2
0
        public void DeleteSanPham(EC_SANPHAM et)
        {
            string sql = "XoaSP";
            SqlConnection con = new SqlConnection(KetNoiDB.getconnect());
            con.Open();
            SqlCommand cmd = new SqlCommand(sql, con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@masp", et.MaSP);

            cmd.ExecuteNonQuery();
            cmd.Dispose();
            con.Close();
        }
예제 #3
0
        public void UpdateSoLuong(EC_SANPHAM et)
        {
            string        sql = "SuaSL";
            SqlConnection con = new SqlConnection(KetNoiDB.getconnect());

            con.Open();
            SqlCommand cmd = new SqlCommand(sql, con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@masp", et.MaSP);
            cmd.Parameters.AddWithValue("@sl", et.SoLuong);
            cmd.ExecuteNonQuery();
            cmd.Dispose();
            con.Close();
        }
예제 #4
0
        public void DeleteSanPham(EC_SANPHAM sp)
        {
            string        sql = "XoaSP";
            SqlConnection con = new SqlConnection(KetNoiDB.getconnect());

            con.Open();
            SqlCommand cmd = new SqlCommand(sql, con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@masp", sp.MaSP);

            cmd.ExecuteNonQuery();
            cmd.Dispose();
            con.Close();
        }
예제 #5
0
        public void UpdateSanPham(EC_SANPHAM et)
        {
            string        sql = "SuaSP";
            SqlConnection con = new SqlConnection(KetNoiDB.getconnect());

            con.Open();
            SqlCommand cmd = new SqlCommand(sql, con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@masp", et.MaSP);
            cmd.Parameters.AddWithValue("@tensp", et.TenSP);
            cmd.Parameters.AddWithValue("@malh", et.MaLH);
            cmd.Parameters.AddWithValue("@soluong", et.SoLuong);
            cmd.Parameters.AddWithValue("@loinhuan", et.LoiNhuan);
            cmd.Parameters.AddWithValue("@gianhap", et.GiaNhap);
            cmd.Parameters.AddWithValue("@mota", et.MoTa);
            cmd.Parameters.AddWithValue("@nsx", et.NSX);
            cmd.Parameters.AddWithValue("@hinhanh", et.HinhAnh);

            cmd.ExecuteNonQuery();
            cmd.Dispose();
            con.Close();
        }
예제 #6
0
        public string InsertSanPham(EC_SANPHAM et)
        {
            string sql = "ThemSP";
            SqlConnection con = new SqlConnection(KetNoiDB.getconnect());
            con.Open();
            SqlCommand cmd = new SqlCommand(sql, con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@tensp", et.TenSP);
            cmd.Parameters.AddWithValue("@malh", et.MaLH);
            cmd.Parameters.AddWithValue("@soluong", et.SoLuong);
            cmd.Parameters.AddWithValue("@loinhuan", et.LoiNhuan);
            cmd.Parameters.AddWithValue("@gianhap", et.GiaNhap);
            cmd.Parameters.AddWithValue("@mota", et.MoTa);
            cmd.Parameters.AddWithValue("@nsx", et.NSX);
            cmd.Parameters.AddWithValue("@hinhanh", et.HinhAnh);

            DataTable dt = new DataTable();
            SqlDataAdapter ad = new SqlDataAdapter(cmd);
            ad.Fill(dt);
            string ma = dt.Rows[0].ItemArray[0].ToString();
            cmd.Dispose();
            con.Close();
            return ma;
        }
예제 #7
0
        public void UpdateSanPham(EC_SANPHAM et)
        {
            string sql = "SuaSP";
            SqlConnection con = new SqlConnection(KetNoiDB.getconnect());
            con.Open();
            SqlCommand cmd = new SqlCommand(sql, con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@masp", et.MaSP);
            cmd.Parameters.AddWithValue("@tensp", et.TenSP);
            cmd.Parameters.AddWithValue("@malh", et.MaLH);
            cmd.Parameters.AddWithValue("@soluong", et.SoLuong);
            cmd.Parameters.AddWithValue("@loinhuan", et.LoiNhuan);
            cmd.Parameters.AddWithValue("@gianhap", et.GiaNhap);
            cmd.Parameters.AddWithValue("@mota", et.MoTa);
            cmd.Parameters.AddWithValue("@nsx", et.NSX);
            cmd.Parameters.AddWithValue("@hinhanh", et.HinhAnh);

            cmd.ExecuteNonQuery();
            cmd.Dispose();
            con.Close();
        }