Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using OleDbDataAdapter.Fill(dataSet) to refresh records

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi. I've got one problem. I've got 3 data adapters in my project. Two of them are used to populate a combo box, for a particular column in a table.

These combo boxes are on one of my forms that can be accessed by clicking a button on my main form. Also on my main form, I have a button to load another form in which I can add records to the table that the 2 data sets use.

On the form with the 2 combo boxes, I have the activate event set to fill the data adapters again. This works great--the newly entered records will show up in the combo boxes.

But my problem is that on the form with the 2 combo boxes, I also have some labels that work off of another table. They have their own data set and dataadapter. I fill the data adapter at form load, which works great. It displays the last record in my table, per my SQL statement.

Now on the SAME form with the combo boxes, and the labels, and all the data adapters, etc., I can add records to the table that uses those lables and the 3rd data set and adapter.

But using the dataadapter.fill() does not refresh what is in those labels. I have tried making a separate button just for the purpose of refilling it, I have tried putting fill in the form activate even and leaving the form, then coming back, but nothing works. The new record will show up if I exit the application and reload it.

Do I need to rebind these labels' text properties or something? If so, how?

It was a lot easier with the old adoControl.refresh.

I've even tried refreshing the labels themselves, just browsing through the methods to see what I could try to do.

Thanks
 
The first thing you have to do is check if the dataset is really updated when you do a (re)fill. When you're sure the correct data is in the dataset, the easiest option is to rebind the controls to the dataset. Because a label is a static object it doesn't automaticly refreshes when the bound data changes.

Arjan Meskers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top