Hi
Does anyone know how to add a session to a datatgrid? I have a shopping basket and each time a user selscts an item, the item id is passed a session, but it is only holding one value. I have tried numerous ways but can't seem to get it working. My code is;
Session("ItemID") = Request.QueryString("titleid")
to retrieve the session:
Public Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Session("ItemID") Is Nothing Then
If Not Page.IsPostBack Then
BindData()
End If
Dim arr As New ArrayList
Dim i As Integer
TextBox1.Text = Session("ItemID")
Dim dr As SqlDataReader
Dim MyCommand As SqlCommand
Dim dv As DataView
dv = Cache("trolley")
If dv Is Nothing Then
Dim MyConnection As SqlConnection = New SqlConnection("server=(local); trusted_connection=true; database=Ecommerce_RachelTracey")
'Data Grid for books
Dim da As SqlDataAdapter = New SqlDataAdapter("SELECT * FROM tblCustomer CROSS JOIN tblCatalogue WHERE (tblCatalogue.ItemID = '" & Session("ItemID") & "') AND (tblCustomer.EmailAddress = '" & User.Identity.Name & "')", MyConnection)
Dim ds As New DataSet
da.Fill(ds, "tblCustomer")
dv = New DataView(ds.Tables("tblCustomer"))
Cache("trolley") = dv
End If
dsTrolley.DataSource = dv
dsTrolley.DataBind()
Else
Response.Write("Sorry you have not ordered any items yet")
End If
End Sub
Does anyone know how to add a session to a datatgrid? I have a shopping basket and each time a user selscts an item, the item id is passed a session, but it is only holding one value. I have tried numerous ways but can't seem to get it working. My code is;
Session("ItemID") = Request.QueryString("titleid")
to retrieve the session:
Public Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Session("ItemID") Is Nothing Then
If Not Page.IsPostBack Then
BindData()
End If
Dim arr As New ArrayList
Dim i As Integer
TextBox1.Text = Session("ItemID")
Dim dr As SqlDataReader
Dim MyCommand As SqlCommand
Dim dv As DataView
dv = Cache("trolley")
If dv Is Nothing Then
Dim MyConnection As SqlConnection = New SqlConnection("server=(local); trusted_connection=true; database=Ecommerce_RachelTracey")
'Data Grid for books
Dim da As SqlDataAdapter = New SqlDataAdapter("SELECT * FROM tblCustomer CROSS JOIN tblCatalogue WHERE (tblCatalogue.ItemID = '" & Session("ItemID") & "') AND (tblCustomer.EmailAddress = '" & User.Identity.Name & "')", MyConnection)
Dim ds As New DataSet
da.Fill(ds, "tblCustomer")
dv = New DataView(ds.Tables("tblCustomer"))
Cache("trolley") = dv
End If
dsTrolley.DataSource = dv
dsTrolley.DataBind()
Else
Response.Write("Sorry you have not ordered any items yet")
End If
End Sub