Visual studio 8.0
table :Groups, two fields : groupnb,groupdef
table Article,three fields : articlenb,group,articledef
I want to show with the DataGridViewComboBoxColumn two fields from groups table .
But i want only link field "articlenb" to column, but a want o show filed "Articlenb" and I want to show fields "groupnb" and "groupdef"
My question is how do this?
Here is my code for ComboBoxColumn, with one field from groups table.
This works well!
myCommand1.Connection = myConn myCommand1.CommandText = "SELECT * FROM article " myAdapter1.SelectCommand = myCommand1 myAdapter1.Fill(MyDataTable1, "article" DataGridView1.DataSource = MyDataTable1 'MyDataTable2 myConn.Open() myCommand2.Connection = myConn myCommand2.CommandText = "SELECT groupnb,groupdef FROM groups order by groupnb" myAdapter2.SelectCommand = myCommand2 myAdapter2.Fill(MyDataTable2) Dim Selectgroup As New DataGridViewComboBoxColumn Selectgroup.DataPropertyName = "group" Selectgroup.HeaderText = "group number" '** fill combo items myReader = myCommand2.ExecuteReader While myReader.Read Selectgroep.Items.Add((myReader("groupnb"))) End While DataGridView1.Columns.Add(Selectgroup)
Thanks for the reply,