Missing data?

pachjo

Well-known member
Joined
Dec 12, 2006
Messages
370
Programming Experience
10+
Can someone advise if there is a delay in data being written to the database following a tableadapter.update(datatable) command?

I save transactions which are subjected to the above and then a listview is updated to reflect them.

As I work through all is OK and the transactions appear in view.

I then run a backup through my app using a backup object to do this and this reports all OK

I then close the app and re-open and as as I am in debug the database is empty.

I perform a restore through my app using a restore object and selecting the backup file I created previoulsy which reports all OK

The retore procedure calls application.restart to allow the app to initialise to the restored data.

The problem is quite a bit of my data in missing from the restore as if the last block I did prior to backup never actaully made it to the database?

I also rememeber noting that at times when the update method is performed the actual timestamp on the physical databse is not updated....until I close the app and return to the designer?

So does this mean then prior to performing a backup I have to somehow force the app to ensure it has written all changes to the databse?

Thanks
 
Read the DNU link in my sig - it should leave you with the impression; dont do testing like this while working in the IDE.

The database is updated the instant a transaction commits.
 
Last edited:
Hi, thanks for this, but I don't think this is the answer:confused:

You see I already learned thanks to this site the 'clean' and 'dirty' versions of the DB.

What is happening with me is the following:

I start with a clean db
I add records
I use the app in built backup utilty
I close the app
I reopen the app and see once again I have a clean db (I expect this)
I use the app in built restore utility
I see my clean db is now partly restored to my previously dirty copy

What I mean is why is only part of my previous dirty db getting backed up?

I have noticed that when looking through Explorer at the dirty db whilst I am running the app that when I call .updat(table) although the views etc in the running app reflect the changes the actual dirty .mdf timestamp does not change.

Sometimes the dirty .mdf timestamp does not change until I close the app and return to the IDE.

Hence I feel there is a delay in writing the changes to the db which might explain why when I did the backup the full changes were not there to be backed up?
 
I can confirm that the database in bin\debug when I first open the app in IDE debug has the date of the clean database.

As I enter data in the app the forms and controls update as expected but the \bin\debug database timestamp does not change.

Once I close the app and am returned to the IDE the timestamp on the \bin\debug database changes to the current date!

So there is a delay......but why?
 
Presumably, windows only updates the time when the last process modifying the file exits?

Think about it.. if you perform one million writes to a file (which you do to write 1 megabyte) and if windows updates the last-modified date in the MFT or wherever it is, every time, then you have to update that date a million times! That might kill your hard disk with thrashing!


Build your project into an exe in a folder in c:\temp and run it from there. DOnt try to investigate this in the IDE with clean/dirty versions and the IDE doing silent copies! Its too complex and confusing, make it simpler on yourself
 
cjard, I bow to your superior knowledge :D

It works a treat exactly as I wanted it to, you were right;)

I published to another computer entered in loads of transactions then ran the inbuilt backup utility.

I uninstalled my app and reinstalled and it was a blank database again.

I used the inbuilt restore and hey presto every transaction is back:D

Thanks a million, really appreciate your help;)
 
Back
Top