My project is in asp.net and sqlserver. Purpose of this site is online shoping for books
Process flow is: User can see 5 books on a page , there is a link called more info
When user selects more info, he gets the detailed description of the book with a choice of Add to Cart and buy it.
I am facing a problem in Add to Cart
'Here is my code for More info.
'Description: When user select LinkButton1 i.e. Add To Cart, then book id is stored in session("BookIDs") 'and page is redirected to add_to_cart.aspx page
Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.Click
On Error GoTo err
Session("BookIDs") = Request.QueryString("bookid")
err: If Session("BookIDs") = 0 Then
Response.Redirect("add_to_cart.aspx?bookid= " & Session("BookIDs") & "")
Following is the code for Add_to_cart on Page Load
Dim myArrList As ArrayList = New ArrayList
Session("MyArrayList") = myArrList
Dim bookids As New ArrayList
myNewArrList = CType(Session("MyArrayList"), ArrayList)
If myNewArrList Is Nothing Then
bookids = New System.Collections.ArrayList
If Not myNewArrList Is Nothing Then
For c = 0 To bookids.Count - 1
For d = 0 To bookids.Count - 1
If d = bookids.Count - 1 Then
myvalue += "'" & bookids(d).ToString & "'"
myvalue += "'" & bookids(d).ToString & "'" & ","
strSQL = "SELECT book_id, [name], author_name, book_size, price from tbl_bookdetails "
strSQL = strSQL & " WHERE book_id in (" & myvalue.Trim & ") "
adp = New SqlDataAdapter(strSQL, conn)
ds = New DataSet
grdcart.DataSource = ds
Problem is i am not able to store multiple of data, i see one one records at a time.
Even when i go to view cart list, i can see only the details which is requested last, but my requirement is to view all the data which is selected to add in cart list until the browser is closed.
Thanx in advance