Results 1 to 3 of 3

Thread: Replacing DAO data control with ADO.NET BindingSource

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2012
    Posts
    7

    Replacing DAO data control with ADO.NET BindingSource

    This is what I need to achieve:
    1. User searches for a product by entering product code.
    2. If user enters partial code name, they are presented with a list to choose from.
    3. Once they choose the product, an edit screen opens with the selected product.

    With DAO data control, I bind the controls on the edit screen at design time. In the code...
    HTML Code:
    ProductControl.RecordSource = "select * from product where code ='" & txtCode & "'"
    ProductControl.Refresh()
    With ADO.NET I've done the foll...
    HTML Code:
    productDataAdapter = SQLDataAdapter("select...")
    productDataAdapter.Fill(productDataSet)
    ProductBindingSource.DataSource = productDataSet
    How do I bind the form controls to the fields in the dataset at "design time" (not run time)? Under DataBindings of the controls I can't see the ProductBindingSource. I only see "None" and "Other Data Sources" which seems like I have to add a DataSet that has a pre-built query.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,296

    Re: Replacing DAO data control with ADO.NET BindingSource

    You would need to add a typed DataSet in the designer to do that.

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2012
    Posts
    7

    Re: Replacing DAO data control with ADO.NET BindingSource

    Thanks. That worked. What was confusing is that as soon as I created a DataSet and BindingSource, VB automatically created the TableAdapter and added code to load the data from the table in some method (I forget which) so as soon as I ran the app, the data was loaded. What I did was to delete the loading code and then fill the dataset with the results of the query.

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