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.
Re: Replacing DAO data control with ADO.NET BindingSource
You would need to add a typed DataSet in the designer to do that.
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.