I'm trying to create a Select Distinct query, but i'm getting stuck with either an empty combobox either a filled combobox that displays all the doubles.
or a message "System.Data.DataViewManagerListItemTypeDescriptor"
I have a form (form5) with 1 combobox and 1 datagrid.
The datagrid loads 5 collumns "ID", "firm", "Fname", "mname", "Lname"
The collumn "firm" will have some double firms with people in the other collumns
ID Firm Fname Mname Lname
1 AA John N West
2 AA Jim L East
3 BB Harry Sick Long
4 CC Barry N Klote
I would like to select the firm from a combobox and filter the datagrid so that it only displays the selected firm and the people that are registred here. Furthermore i want the combobox that i use for selecting the firms to lose the doubles.
I can load the datagrid and load the Combobox, but selecting is only pointing to the record (highlights in the grid) i chooses but doesn't filter. Is there anyone that can give me a clue on how to solve this.
Private Sub Form5_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load 'TODO: This line of code loads data into the 'Kjelpasser2012DataSet.Employees' table. You can move, or remove it, as needed. Me.EmployeesTableAdapter.Fill(Me.passer2012DataSet.Employees) 'Select DISTINCT "firm" from "Employees" 'End Select End Sub Collapse | Copy Code 'TODO: This line of code loads data into the 'passer2012DataSet.Employees' table. You can move, or remove it, as needed. Dim ds As New passer2012DataSet Dim con As New OleDb.OleDbConnection Dim da As New OleDb.OleDbDataAdapter("Select DISTINCT firm from Employees", con) Dim dt As New DataTable 'i made this text 'Me.passer2012DataSet.Employees.Open() ' da.Fill(ds) 'dt = ds.Tables(0) 'databinding() cmbfirma.DataSource = ds cmbfirma.DisplayMember = "employeeID" 'DataTextField = "employeeID" cmbfirma.ValueMember = "Firma" 'DataValueField = "Firma" Me.EmployeesTableAdapter.Fill(Me.passer2012DataSet.Employees) con.Close()
I use the "Me.EmployeesTableAdapter.Fill" method so mu question is, is it possible that i don't need to use the OLEDB connection or do i still need this to correctly connect to the DB (access)? I changed the script that i brewed together as displayed above, but this did not do the trick.
The combobox fills with the following text.
or shows the doubles.
Is there anyone that can help me solve this last piece of my puzzle?