Problem in Data binding in V.B.Net kindly help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rohan101
    New Member
    • Jan 2007
    • 2

    Problem in Data binding in V.B.Net kindly help

    I am having problem with value member and display member property
    when I do I am receiving error "cannot create childlist for feild employees"
    here is the code

    Dim con As New SqlConnection(" workstation id=SWAP;packet size=4096;user id=sa;data source=swap;per sist security info=False;init ial catalog=Northwi nd")
    Dim adpt As New SqlDataAdapter( "select * from employees", con)
    Dim ds As New DataSet
    adpt.Fill(ds)
    DataGrid1.DataS ource = ds
    'DataGrid1.Data Member = "employees"


    ComboBox1.DataS ource = ds
    ComboBox1.Value Member = "employees.firs tname"
    ComboBox1.Displ ayMember = "employees.last name"
  • Ganon11
    Recognized Expert Specialist
    • Oct 2006
    • 3651

    #2
    I'm going to move this to the .NET forum, where I think you'll have a better chance of getting help.

    Comment

    • bplacker
      New Member
      • Sep 2006
      • 121

      #3
      Originally posted by Rohan101
      I am having problem with value member and display member property
      when I do I am receiving error "cannot create childlist for feild employees"
      here is the code

      Dim con As New SqlConnection(" workstation id=SWAP;packet size=4096;user id=sa;data source=swap;per sist security info=False;init ial catalog=Northwi nd")
      Dim adpt As New SqlDataAdapter( "select * from employees", con)
      Dim ds As New DataSet
      adpt.Fill(ds)
      DataGrid1.DataS ource = ds
      'DataGrid1.Data Member = "employees"


      ComboBox1.DataS ource = ds
      ComboBox1.Value Member = "employees.firs tname"
      ComboBox1.Displ ayMember = "employees.last name"
      I don't think you have to specify which table the data is coming from, just say ComboBox1.Value Member = "firstname" .

      if this doesn't work, you might have to say
      ComboBox1.Value Member = ds.Tables(0).Co lumns("firstnam e")

      Comment

      Working...