Convert string to DataTable object
Posted on 2004-10-05
I would like to create up to 10 DataTables on the fly. All of the tables have the same structure. The difficulty I have is creating a DataTable name from a string based on a counter. I have not been able to find a way to convert the string to a DataTable name.
Dim ds As New DataSet
Dim abc As String
Dim counter As Integer
Dim dt As String
dt = “abc” + counter
No matter which way I have tried to covert the string dt to a DataTable object, I always come up with the same message—Value of String cannot be converted to System.Data.DataTable- Please help.