Adding a datatable and a session containing datatable
asp.net, datatable, vb.net
Solution
I would try something like this:
Dim MyDataSet1 As New DataSet()
Dim MyDataSet2 As New DataSet()
Dim dt1 As New DataTable() = ctype(Session("Table"), DataTable)
Dim dt2 As New DataTable() = obj.GetCustomer()
MyDataSet1.Tables.Add(dt1)
MyDataSet2.Tables.Add(dt2)
MyDataSet1.Merge(MyDataSet2)
Session("Table") = MyDataSet1.Tables(0)
Chris
Problem
I have a session which contains a datatable and also have a function which returns a datatable. I need to add these two. How can I do this? The below code is to be replaced with correct code. ``` Session("Table")=Session("Table")+obj.GetCustomer() ``` ...where obj is an object of the business layer. The '+' sign cannot be used to add these two, so how can I do this?