data table with session

  • Thread starter Thread starter ven
  • Start date Start date
V

ven

Hello i have one aspx page with vb code :

Dim zam As System.Data.DataTable

Dim PrimKey(1) As DataColumn

Dim myColumn As DataColumn = New DataColumn("id")

myColumn.ReadOnly = True

myColumn.AutoIncrement = True

myColumn.AutoIncrementSeed = 1

zam = New System.Data.DataTable("zam")

zam.Columns.Add(myColumn)

zam.Columns.Add("data_zamowienia", GetType(Date))

zam.Columns.Add("id_artykulu", GetType(Integer))

zam.Columns.Add("ilosc", GetType(Integer))

zam.Columns.Add("cena_netto", GetType(Decimal))

zam.Columns.Add("cena_brutto", GetType(Decimal))

zam.Columns.Add("kod_vat", GetType(Integer))

zam.Columns.Add("jednostka", GetType(String))

zam.Columns.Add("tryb", GetType(Integer))

zam.Columns.Add("typ", GetType(Integer))

zam.Columns.Add("indeks", GetType(String))

zam.Columns.Add("nazwa", GetType(String))

PrimKey(0) = zam.Columns("id")

zam.PrimaryKey = PrimKey

Session("zam") = zam

-----------------------------------------

and on the second aspx page i want to show this table and i use :

Dim zam As System.Data.DataTable

zam = session("zam")

ShoppingCart.DataSource = zam

ShoppingCart.DataBind()

and this is not working, i dont know why , i use that method on one aspx
page and it works but dont wanna work on other page, i get null reference
exception in :

ShoppingCart.DataSource = zam



Please give me a solution for dynamic table that works on all pages in one
web service



Patrick D.
 
That shouldn't crash if 'zam' is nothing. That should crash if
'ShoppingCart' is nothing, since you are trying to access its DataSource
property, and that woudl fail if the object is null in the first place.
 
U¿ytkownik "Marina said:
That shouldn't crash if 'zam' is nothing. That should crash if
'ShoppingCart' is nothing, since you are trying to access its DataSource
property, and that woudl fail if the object is null in the first place.

thank you
my repeater have another name that shoppingcart :)

Patrick
 
Back
Top