private void BindProductCart() { Sepet sepet = new Sepet(); SqlConnection con = new SqlConnection(ConnectString); con.Open(); SqlCommand command = new SqlCommand("select * from Sepet where KullaniciId=@ui and Durum=@d", con); command.Parameters.AddWithValue("@ui", Convert.ToInt32(Session["UserID"])); command.Parameters.AddWithValue("@d", false); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { sepet.id = Convert.ToInt32(reader[0]); sepet.sepettutarı = Convert.ToDecimal(reader[1]); sepet.Durum = Convert.ToBoolean(reader[4]); count++; } reader.Close(); SqlCommand komut2 = new SqlCommand("select P.id, P.ProductImages, P.ProductName, P.ProductPrice from SepetDetay S inner join Table_Product P on P.id=S.UrunId inner join Sepet Sp on Sp.id=S.SepetId where S.SepetId=@sepetId", con); komut2.Parameters.AddWithValue("@sepetId", sepet.id); DataTable dt = new DataTable(); SqlDataAdapter sda = new SqlDataAdapter(komut2); sda.Fill(dt); CarTotalSpan.InnerText = sepet.sepettutarı.ToString(); RepeaterProductCart.DataSource = dt; RepeaterProductCart.DataBind(); con.Close(); }
private void BindProductCart() { SqlConnection con = new SqlConnection(ConnectString); con.Open(); SqlCommand cmd = new SqlCommand("select P.id, P.ProductName, P.ProductDescription,P.ProductImages,P.ProductPrice, C.CategoryName,B.Name from Table_Product P inner Join Tbl_Category C on C.CategoryId=P.Category inner join Tbl_Brands B on B.BrandId=P.Brand ", con); cmd.ExecuteNonQuery(); DataTable dt = new DataTable(); SqlDataAdapter sda = new SqlDataAdapter(cmd); sda.Fill(dt); RepeaterProductCart.DataSource = dt; RepeaterProductCart.DataBind(); con.Close(); }
private void BindProductRepeater() { SqlConnection con = new SqlConnection(ConnectString); con.Open(); if (Request.QueryString["ürün"] != null) { string data = Request.QueryString["ürün"].ToString(); //burada olmadı!! SqlDataAdapter sda = new SqlDataAdapter("select P.id, P.ProductName, P.ProductDescription,P.ProductImages,P.ProductPrice, C.CategoryName,B.Name from Table_Product P inner Join Tbl_Category C on C.CategoryId=P.Category inner join Tbl_Brands B on B.BrandId=P.Brand where (ProductName like '%" + data + "%')", con); DataTable dt = new DataTable(); sda.Fill(dt); RepeaterProductCart.DataSource = dt; RepeaterProductCart.DataBind(); con.Close(); } else { Response.Redirect("~/AdminProducts.aspx"); } }