Hi
im having a stupid problem and i dont know why
what i want is just to put a list of datatables into 1 table
sometimes i get an error saying the column f1 is already used by the othertable - if so how do i get around that
sometimes i get no error but an empty gridview
could i not just insert the tables straight into a dttable when i get the data from the connection?
please help :)
im having a stupid problem and i dont know why
what i want is just to put a list of datatables into 1 table
Code:
Dim MyConnection As System.Data.OleDb.OleDbConnection
Dim DtSet As System.Data.DataTable
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
MyConnection = New System.Data.OleDb.OleDbConnection(ConnectionString)
MyCommand = New System.Data.OleDb.OleDbDataAdapter("select * from [test$]", MyConnection)
MyCommand.TableMappings.Add("Table", "TestTable")
DtSet = New System.Data.DataTable
MyCommand.Fill(DtSet)
testtables.Add(DtSet)
MyConnection.Close()
MyConnection = New System.Data.OleDb.OleDbConnection(ConnectionString)
MyCommand = New System.Data.OleDb.OleDbDataAdapter("select * from [test$]", MyConnection)
MyCommand.TableMappings.Add("Table", "TestTable")
DtSet = New System.Data.DataTable
MyCommand.Fill(DtSet)
testtables.Add(DtSet)
MyConnection.Close()
DtSet = New System.Data.DataTable("Test")
For Each item As System.Data.DataTable In testtables
For Each item2 As DataRow In item.Rows
DtSet.ImportRow(item2)
Next
Next
DataGridView1.DataSource = DtSet
sometimes i get no error but an empty gridview
could i not just insert the tables straight into a dttable when i get the data from the connection?
please help :)