Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I'm trying to find the largest number in a table with:
TblInventoryTableAdapter.GetData.Compute("Max(InvID)", Nothing)


The code works just dandy. However for reasons unknown, it does not update while my program is already running. When I enter a larger value, it I have to close my app and open it again before it returns my newly entered larger number. Just closing and reopening the form does not work, the entire application needs to be closed and reopened.

I'm also reading the row count with: TblInventoryTableAdapter.GetData.Rows.Count, at the same time as finding the largest number. The row count updates, which means the TableAdaptor is updating. So for reasons unknown Compute does not include new records.:confused:

Do I have to somehow release the compute function from the table adaptor, similarly to how you remove a filter when you are done filtering data?

I have tried TblInventoryTableAdapter.Update(Me.AccommodationDataSet.tblInventory) but no difference.

Any help would be greatly appreciated

Marco
Posted
Updated 10-Oct-10 21:36pm
v2
Comments
[no name] 11-Oct-10 5:55am    
Is this a Microsoft thing? If been playing around with some of the TableAdaptor functions and now it updates every second record. I'm confused

1 solution

Did you try TblInventoryTableAdapter.Fill? If you set Clear before fill to true, I think the table adapter goes back to the database to get everything fresh.
 
Share this answer
 
Comments
[no name] 12-Oct-10 2:00am    
Hi terpy,

Thanks for the help, I tried that already it only updates every two records. I believe that TblInventoryTableAdapter.GetData.Reset() does the same thing.

It simply must be one of those Microsoft things, im just going to try something completely different.

Thanks Though.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900