08-07-2013 12:44 PM
I am writing to a access database but get inconsitent writes.
Sometimes it is written, sometime not without any way of me knowing when this will happen.
I am able to double check the write afterwards with Access but I woul like to programatically confirm that I have written to the database.
The Setup: access 2007 connected via ODBC over a local network.
attached is a simple vi to insert text data to a table in the database "testDataBase"
Solved! Go to Solution.
08-07-2013 07:34 PM
You have two choices:
1. Don't use the connectivity toolkit. It throws away errors.
2. Try to read back the record after you have written it.
Also make sure that your code can propegate errors and report them when they occur.
Of the two choices, my preference would be Number 1.
Mike...
PS: Check here for an alternative...
08-07-2013 11:59 PM - edited 08-08-2013 12:00 AM
If you are using acccess then you are using very complicated way for writing. Why not using udl file?
After writing if there is no error and read it back is 2 options
08-08-2013 03:00 AM
@mikeporter wrote:
You have two choices:
1. Don't use the connectivity toolkit. It throws away errors.
2. Try to read back the record after you have written it.
Also make sure that your code can propegate errors and report them when they occur.
Of the two choices, my preference would be Number 1.
Mike...
PS: Check here for an alternative...
3 actually, you can use Transaction, which should be self verifying.
/Y
08-08-2013 05:44 AM
Hi Yamaeda,
Can you elobrate
08-08-2013 10:42 AM
Database transactions can be useful for ensuring that multiple database modification occur atomically, but they won't help with the OP's original problem which is that errors don't seem to be reported.
Mike...
08-08-2013 11:17 PM - edited 08-08-2013 11:17 PM
How it can be useful for verifying database write?
08-09-2013 06:35 AM
I will use my current situation as an example.
I am writing data to tables in a database for testing of a piece of instrumentation. This data will later be used for statistical analysis on the quality of the instruments and verification of design stability.
Issuing an insert command does not guarantee and actual write to the database in my situation. Thus I must verify that it is written correctly. The database Connectivity toolset should be reporting errors yet it is not.
This causes uncertainty in the data collected as there are missing pieces of data.
I have for testing purposes implemented the 2nd option, to try to find the unique keys I have issued to the database. If they exist that is proof that data has been written.
The unique keys come from linked tables.
I would like to attempt to implement the first option from Mikeporter. But it will take more time to test and I have been tasked with other duties. Hopefully in a week I have completed my testing and can implement it.