Esempio n. 1
0
        //public static  SqlDataReader rd;

        public void Fill_DataSet()
        {
            Connect_DB.Ketnoi_CSDL();
            da = new SqlDataAdapter(sql, Connect_DB.ketnoi);
            ds = new DataSet();
            da.Fill(ds);
            da.Dispose();
            Connect_DB.ketnoi.Close();
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string     st      = Request.QueryString.Get("id");
            Connect_DB cls_con = new Connect_DB();

            cls_con.Open();
            string query = "Select ID,Name,Price from KhuyenMaiHapDan where ID='" + st + "';";

            sqlcm = new SqlCommand(query, cls_con.sql_con);
            SqlDataReader result = sqlcm.ExecuteReader();

            while (result.Read())
            {
                Name_Pro.Text  = result.GetValue(1).ToString();
                Price_Pro.Text = result.GetValue(2).ToString() + " đ";
            }
            cls_con.Closed();
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Connect_DB cls_con = new Connect_DB();

            cls_con.Open();
            string        query      = "select Name,Price,status  from ThoiTrang;";
            SqlCommand    sqlFashion = new SqlCommand(query, cls_con.sql_con);
            SqlDataReader result     = sqlFashion.ExecuteReader();
            string        st         = "";
            int           i          = 0;
            string        status     = "";

            while (result.Read())
            {
                if (result.GetValue(2).ToString() == "true")
                {
                    status = "Còn Hàng";
                }
                else if (result.GetValue(2).ToString() == "false")
                {
                    status = " Đã Hết Hàng";
                }
                i++;
                st = st + "<div class=\"col-md-3 col-sm-4 col-xs-6\">"
                     + "<div class=\"product\">"
                     + "<div class=\"img\">"
                     + "<img src=\"../Images/Fashion/fashion" + i + ".jpg\"/>"
                     + "<button Class=\"btn btn-success\"/>Mua Ngay</button>"
                     + "<span class=\"status\">" + status + "</span>"
                     + "</div>"
                     + "<span class=\"product__name\">" + result.GetValue(0).ToString() + "</span>"
                     + "<hr />"
                     + "<span class=\"product__price\">" + result.GetValue(1).ToString() + "</span><sup style=\"color: red\">đ</sup>"
                     + "</div/>"
                     + "</div/>";
            }
            result.Close();
            View.Text = st;
        }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Connect_DB cls_con = new Connect_DB();

            cls_con.Open();
            String query_khuyenmaihapdan = "select Sale,name,status,price,ID from KhuyenMaiHapDan;";

            sqlcm = new SqlCommand(query_khuyenmaihapdan, cls_con.sql_con);
            SqlDataReader Result = sqlcm.ExecuteReader();

            string[] sale   = new string[30];
            string[] name   = new string[30];
            string[] price  = new string[30];
            string[] Status = new string[30];
            string[] Id     = new string[30];
            int      i      = 0;

            while (Result.Read())
            {
                sale[i]   = Result.GetValue(0).ToString();
                name[i]   = Result.GetValue(1).ToString();
                Status[i] = Result.GetValue(2).ToString();
                price[i]  = Result.GetValue(3).ToString();
                Id[i]     = Result.GetValue(4).ToString();
                i++;
            }
            sale_1.Text = "-" + sale[0] + "%";
            sale_2.Text = "-" + sale[1] + "%";
            sale_3.Text = "-" + sale[2] + "%";
            sale_4.Text = "-" + sale[3] + "%";
            sale_5.Text = "-" + sale[4] + "%";
            sale_6.Text = "-" + sale[5] + "%";
            sale_7.Text = "-" + sale[6] + "%";
            name_1.Text = name[0];
            name_2.Text = name[1];
            name_3.Text = name[2];
            name_4.Text = name[3];
            name_5.Text = name[4];
            name_6.Text = name[5];
            name_7.Text = name[6];
            if (Status[0] == "True")
            {
                status_1.Text = "Còn Hàng";
            }
            else
            {
                status_1.Text = "Hết Hàng";
            }
            if (Status[1] == "True")
            {
                status_2.Text = "Còn Hàng";
            }
            else
            {
                status_2.Text = "Hết Hàng";
            }
            if (Status[2] == "True")
            {
                status_3.Text = "Còn Hàng";
            }
            else
            {
                status_3.Text = "Hết Hàng";
            }
            if (Status[3] == "True")
            {
                status_4.Text = "Còn Hàng";
            }
            else
            {
                status_4.Text = "Hết Hàng";
            }
            if (Status[4] == "True")
            {
                status_5.Text = "Còn Hàng";
            }
            else
            {
                status_5.Text = "Hết Hàng";
            }
            if (Status[5] == "True")
            {
                status_6.Text = "Còn Hàng";
            }
            else
            {
                status_6.Text = "Hết Hàng";
            }
            if (Status[6] == "True")
            {
                status_7.Text = "Còn Hàng";
            }
            else
            {
                status_7.Text = "Hết Hàng";
            }
            //cls_con.Closed();

            String query_HangMoiVe = "select Name,status,price,ID from HangMoive;";

            sqlcm = new SqlCommand(query_HangMoiVe, cls_con.sql_con);
            SqlDataReader Result1 = sqlcm.ExecuteReader();

            string[] sale1   = new string[30];
            string[] name1   = new string[30];
            string[] Status1 = new string[30];
            int      i1      = 0;

            while (Result1.Read())
            {
                name1[i]   = Result.GetValue(1).ToString();
                Status1[i] = Result.GetValue(2).ToString();
                i1++;
            }
            name_8.Text  = name1[0];
            name_9.Text  = name1[1];
            name_10.Text = name1[2];
            name_11.Text = name1[3];
            if (Status[0] == "True")
            {
                status_8.Text = "Còn Hàng";
            }
            else
            {
                status_9.Text = "Hết Hàng";
            }
            if (Status[1] == "True")
            {
                status_10.Text = "Còn Hàng";
            }
            else
            {
                status_11.Text = "Hết Hàng";
            }
        }