Results 1 to 4 of 4

Thread: System.Data.DataRowView instead of data

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2009
    Posts
    7

    System.Data.DataRowView instead of data

    Hi

    I'm new in vb so I think it's a simple answer for you quys
    I'm using vb express but didn't find it on the forum.

    I'm trying to fill a combobox from a mysql query but I only get rows filled with System.Data.DataRowView
    Can somebody explain to me what i'm doing wrong ?

    Here is my code

    Dim DA_dossier As New MySqlDataAdapter("select dossiernr from overzicht", con)
    Dim DT_dossier As New DataTable("dossiers")

    DA_dossier.Fill(DT_dossier)
    If DT_dossier.Rows.Count > 0 Then
    ComboBox_subcategorie.ValueMember = "dossiernr"
    ComboBox_subcategorie.DisplayMember = "dossiers"
    ComboBox_subcategorie.DataSource = DT_dossier
    con.Close()
    Else
    ComboBox_subcategorie.DataSource = Nothing
    ComboBox_subcategorie.Text = "<Empty>"
    con.Close()
    End If

  2. #2
    PowerPoster
    Join Date
    Oct 2010
    Posts
    2,141

    Re: System.Data.DataRowView instead of data

    Your "Select" statement only returns a single column "dossiernr" that you use as the combobox's "ValueMember". However, you have set the combobox's "DisplayMember" to "dossiers" and this column does not exit in DT_dossier.

    Change: "select dossiernr from overzicht" to "select dossiernr, dossiers from overzicht".

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2009
    Posts
    7

    Re: System.Data.DataRowView instead of data

    Thanks that solved it, so the displaymember name must match the columnname from the database ?
    I thought it was the valuemember name ?
    What's the difference between those two ?

  4. #4
    PowerPoster
    Join Date
    Oct 2010
    Posts
    2,141

    Re: System.Data.DataRowView instead of data

    Quote Originally Posted by bikkerss View Post
    Thanks that solved it, so the displaymember name must match the columnname from the database ?
    I thought it was the valuemember name ?
    What's the difference between those two ?
    https://msdn.microsoft.com/en-us/lib...vs.110%29.aspx

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width