User283571144 posted
Hi jb2_86_uk,
According to your description, I suggest you could consider using sql adapter to achieve reduce your coding.
You could directly generate a datatable from the sqladapter and put that datatable into session,
More details, you could refer to below codes:
Private Sub OleDbDataAdapter_Click(ByVal sender As Object, ByVal Args As System.Event)
'Create a connection object
Dim ConnectionString As String = "provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source= C:/northwind.mdb"
Dim SQL As String = "SELECT * FROM Orders"
Dim conn As OleDbConnection = New OleDbConnection(ConnectionString)
' open the connection
conn.Open()
' Create an OleDbDataAdapter object
Dim adapter As OleDbDataAdapter = New OleDbDataAdapter()
adapter.SelectCommand = New OleDbCommand(SQL, conn)
' Create Data Set object
Dim ds As DataSet = New DataSet("orders")
' Call DataAdapter's Fill method to fill data from the
' DataAdapter to the DataSet
adapter.Fill(ds)
Session("datatable") = ds
End Sub
Best Regards,
Brando