コード例 #1
0
        private void BindAllProductsRptr()
        {
            DataTable categoryData = new DataTable();

            if (Request.QueryString["type"].Trim().Equals("All"))
            {
                //h1noOfItems.InnerText = "My Products if";
                SqlCommand cmd = new SqlCommand("SELECT ProductPrice,ImageData,ProductName,ProductCode From PDetails");
                categoryData = access.SelectFromDatabase(cmd);
            }
            else
            {
                string gender = Request.QueryString["type"].Trim('#');
                h1noOfItems.InnerText = "My Products";
                SqlCommand cmd = new SqlCommand("SELECT ProductPrice,ImageData,ProductName,ProductCode From PDetails where Gender=@gender");
                cmd.Parameters.AddWithValue("@gender", gender);
                categoryData = access.SelectFromDatabase(cmd);
            }

            if (categoryData.Rows.Count > 0)
            {
                h1noOfItems.InnerText     = "My Products";
                MyProductsRptr.DataSource = categoryData;
                MyProductsRptr.DataBind();
            }
            else
            {
                h1noOfItems.InnerText       = "No products";
                MyProductsRptr.DataSource   = null;
                MyProductsRptr.DataSourceID = null;
                MyProductsRptr.DataBind();
            }
        }
コード例 #2
0
        private void BindMyProductsRptr(String catId)
        {
            DataTable categoryData = new DataTable();

            if (Request.QueryString["type"].Equals("All") || Request.QueryString["type"] == null)
            {
                SqlCommand cmd = new SqlCommand("SELECT ProductPrice,ImageData,ProductName,ProductCode From PDetails Where CategoryId = @CatId");
                cmd.Parameters.AddWithValue("@CatId", catId);
                categoryData = access.SelectFromDatabase(cmd);
            }
            else
            {
                SqlCommand cmd = new SqlCommand("SELECT ProductPrice,ImageData,ProductName,ProductCode From PDetails Where CategoryId = @CatId AND Gender=@gender");
                cmd.Parameters.AddWithValue("@gender", Request.QueryString["type"]);
                cmd.Parameters.AddWithValue("@CatId", catId);
                categoryData = access.SelectFromDatabase(cmd);
            }

            if (categoryData.Rows.Count > 0)
            {
                h1noOfItems.InnerText     = "My Products";
                MyProductsRptr.DataSource = categoryData;
                MyProductsRptr.DataBind();
            }
            else
            {
                MyProductsRptr.DataSource   = null;
                MyProductsRptr.DataSourceID = null;
                MyProductsRptr.DataBind();
                h1noOfItems.InnerText = "No products";
            }
        }
コード例 #3
0
        private void BindMyProductsRptr()
        {
            DataTable  categoryData = new DataTable();
            SqlCommand cmd          = new SqlCommand("SELECT ProductPrice,ImageData,ProductName,ProductCode From PDetails Where VendorId = @VId");

            cmd.Parameters.AddWithValue("@VId", currentVendorId);
            categoryData = access.SelectFromDatabase(cmd);

            if (categoryData.Rows.Count > 0)
            {
                h1noOfItems.InnerText     = "My Products";
                MyProductsRptr.DataSource = categoryData;
                MyProductsRptr.DataBind();
            }
            else
            {
                h1noOfItems.InnerText = "You have not added any product till now";
            }
        }