I really need your help on it.My application is supposed to capture every single user input and store in session variable session("MyCat") in the form of datatable. When page is first loaded, datatable will be initiated and session created. And all subsequent user input will be added in session("MyCat") by adding new rows. My code is as below:
Sub Page_Load(Sender as Object, e as EventArgs)
if NOT IsPostBack then
Dim dTable as DataTable
dTable = New DataTable("mySearch")
dTable.Columns.Add("catagory", System.Type.getType("System.String"))
dTable.Columns.Add("keyword", System.Type.getType("System.String"))
dTable.Columns.Add("ID", System.Type.getType("System.Int32"))
session("myCat")= dTable
end if
end sub

Sub Submit(Sender As Object, e As EventArgs)
dim dr as DataRow=dTable.NewRow()
session("myCat")= dTable

Anyway, system captures error when
dim dr as DataRow=dTable.NewRow()
is executed.Error message is :System.NullReferenceException: Object reference not set to an instance of an object
Can any more offer me help on it and let me know if there is any better solution for it...

Ok, this is the problem
You can't do this per say.


but what you shoul do is this:


You need to convert it to a string. dTable is not set to anything recognizable (as the error message states).

Hope this helps!

*Note* Please use the CODE brackets when displaying several lines of code.