I am working on an existing VB.NET + MS Access application. The VB.NET code queries the access db to get some data. For that -
- I retrieved the Maximum value of Autonumber field, using MAX.
- Generated a random value between 1 & MAX(Autonumber) field using Rnd function.
I coded the logic and executed the code successfully. I got the max Autonumber as 968, even though total number of records was only 501. Then I realized that some of the Autonumber rows are missing. Hence I dropped the table and created another table and populated it again. Now when I execute the SELECT MAX ...
from VB.NET I still get the old value of 968 but if I execute the query from MS Access, I get the result as 501. I could think of nothing and closed the application, Visual Studio and started again but still I am getting the old value.
I am using ExecuteScalar
to get the data from ms access.
What is happening, how can I fix it? Any ideas or pointers will be greatly appreciated.