From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

database overwrite

Dear Sir/Madam,
After measurement, we are writing data in to microsoft data base as (filename.mdb). 
Accidentally, we found some error in the measurement, we want to rerun the measurement and we want to overwrite the data. 
Kindly give me an example for overwriting in to database of the current measurement. 
Look forward to see your reply.
Thanking you.
Sincerely,
 
0 Kudos
Message 1 of 3
(2,281 Views)
In SQL, you use the UPDATE command. The syntax is "UPDATE table_name [options] SET col_name = expr,... [WHERE clause]". For example: "UPDATE testres SET meas = 3.45 WHERE id = 453".
0 Kudos
Message 2 of 3
(2,275 Views)

A couple points that might seem like splitting hairs, but they are important. To begin with, the UPDATE command that Dennis described to you will modify existing records one at a time-at least in the form he gave it. Now you could create a version of your software that would use the UPDATE command to modify the existing records, but the effort would be for the most part pointless. To see why, you first need realize that the whole logical structure of the files and databases are different.

In a file you have a block of undifferentiated memory that you can write anything to that you want. If you make a mistake in the first 1000 bytes and just continue on, that memory space is essentially lost--hence the need to start back at the beginning of the file and overwrite it.

Databases on the other hand go to extreme lengths to hide the actual data storage from you. With a database you work with records which are logical entities that bear no direct relationship to any physical storage. Therefore if you add on new records and delete old ones there is no lost memory or wasted file space, because the database system is managing the storage and will reuse memory automatically.

However that doesn't mean that if you delete 1000 records that your database will get any smaller. Most database management systems will grow their files as needed, but don't automatically make them smaller--even if they are largely empty. The reason for this is simple: Why release disk space back to the OS that it may be needing again soon anyway? Saves time to hang onto the disk space that it already has.

What you probibly want to do is basically nothing. Continue running your existing (fixed) software and continue appending new records. You can delete the old invalid records any time you want using the DELETE command. By the way, these commands are from SQL, a standardized command language for talking to databases. You can find many good tutorials on SQL online.

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 3
(2,264 Views)