K
Ken
I'm trying to run a loop to capture column property information from a
table in my datasource. Can anybody see where this is going wrong?
Dim tbl As New DataTable
Dim col As DataColumn
Dim x As Integer
Dim colName(99) As String
Dim colType(99) As String
cn.Open()
tbl = cn.GetSchema("Orders") 'Orders is a table in the
datasource
For Each col In tbl.Columns
x += 1
colName(x) = col.ColumnName.ToString()
colType(x) = col.DataType.ToString()
Next
cn.Close()
If it's not obvious, my intended result are two variables for each
column from the original datatable that will capture a) the name of
the column, and b) the datatype of the column. I will then use these
variables to drive subsequent logic.
I'm getting an error on the GetSchema line: The requested collection
(Orders) is not defined.
I have little experience with the GetSchema method, so any advice on
how to accomplish this is appreciated.
Thx,
Ken
table in my datasource. Can anybody see where this is going wrong?
Dim tbl As New DataTable
Dim col As DataColumn
Dim x As Integer
Dim colName(99) As String
Dim colType(99) As String
cn.Open()
tbl = cn.GetSchema("Orders") 'Orders is a table in the
datasource
For Each col In tbl.Columns
x += 1
colName(x) = col.ColumnName.ToString()
colType(x) = col.DataType.ToString()
Next
cn.Close()
If it's not obvious, my intended result are two variables for each
column from the original datatable that will capture a) the name of
the column, and b) the datatype of the column. I will then use these
variables to drive subsequent logic.
I'm getting an error on the GetSchema line: The requested collection
(Orders) is not defined.
I have little experience with the GetSchema method, so any advice on
how to accomplish this is appreciated.
Thx,
Ken