List of datatable. Initialisation?

datatable

#1

Hello,

I am developing a robot where I need to manipulated a list of datatable. While running the robot I have an error message saying the variable is not initialised.

However, I have initalised my list as follow: “new list(of datatable)({dt1,dt2})” where dt1 and dt2 are datatable.

Can anyone help ?
Thank you

BR,

Quentin Prevost


#2

It works when you initialize it with new list(of datatable) and then use ‘Add to Collection’ activities to add the datatables. There might still be a better way, but that’s the best I can do now.


#3

Hi,

You should try like the following, you cant initialize two datatable at the starting, since it accepts only one parameter.

Dim dt1 As System.Data.DataTable = New System.Data.DataTable()
Dim dt2 As System.Data.DataTable = New System.Data.DataTable()
Dim dtList As List(Of System.Data.DataTable) = New List(Of System.Data.DataTable)(2)
dtList.Add(dt1)
dtList.Add(dt2)


#4

I think you can use dataset instead of list of datatable where you can easily set table name and other parameters.
It would be easy to perform operations on dataset as compared to list.
Thanks


#5

Thank you for your answer. I will try your suggestions!
Thanks :slight_smile:

Quentin