data table with session

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.
 
M

Marina

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.
 
V

ven

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top