K
KeesBlunder
Guest
I am trying to get some data from 2 Tabels in a sqlce database and put it in a datagridview
Trying this but i gives an error.
The plan is to search on Reisnr and not on Id , Id is not the same in the 2 Tabels and Reisnr (is a number of the journey )
For example journey nr 14 is present in both
cmd = New SqlCeCommand("Select Reisnr, Subnr, Plaats, Kgladen, Bestemming, From Laden
UNION
Select Reisnr, Subnr, Kgbdn, Plaats, From Lossen", con)
If con.State = ConnectionState.Closed Then con.Open()
myDA = New SqlCeDataAdapter(cmd)
myDataSet = New DataSet()
myDA.Fill(myDataSet, "MyTable")
DataGridView4.DataSource = myDataSet.Tables("MyTable").DefaultView
con.Close()
The error
![1365142.jpg 1365142.jpg](https://www.computerhelp.forum/data/attachments/55/55626-0dbadc43186c9bb8903f4228cf09c3ce.jpg?hash=DbrcQxhsm7)
This is a small example of some Columns of Laden and Lossen
![1365141.jpg 1365141.jpg](https://www.computerhelp.forum/data/attachments/55/55627-6ee8bb699ac7b19b8bf43181ec277d30.jpg?hash=bui7aZrHsZ)
Continue reading...
Trying this but i gives an error.
The plan is to search on Reisnr and not on Id , Id is not the same in the 2 Tabels and Reisnr (is a number of the journey )
For example journey nr 14 is present in both
cmd = New SqlCeCommand("Select Reisnr, Subnr, Plaats, Kgladen, Bestemming, From Laden
UNION
Select Reisnr, Subnr, Kgbdn, Plaats, From Lossen", con)
If con.State = ConnectionState.Closed Then con.Open()
myDA = New SqlCeDataAdapter(cmd)
myDataSet = New DataSet()
myDA.Fill(myDataSet, "MyTable")
DataGridView4.DataSource = myDataSet.Tables("MyTable").DefaultView
con.Close()
The error
![1365142.jpg 1365142.jpg](https://www.computerhelp.forum/data/attachments/55/55626-0dbadc43186c9bb8903f4228cf09c3ce.jpg?hash=DbrcQxhsm7)
This is a small example of some Columns of Laden and Lossen
![1365141.jpg 1365141.jpg](https://www.computerhelp.forum/data/attachments/55/55627-6ee8bb699ac7b19b8bf43181ec277d30.jpg?hash=bui7aZrHsZ)
Continue reading...