LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MS Access multiple writes from LV

I have a some software that collects data and at the end writes all of it using the ADO vis to an MS Access database, this is in a sequence frame.
For some reason every so often it writes 8 identical records instead of just the one.
I am running the software on several win 2000 600mhz 128MB machines. The database records have upto 45 fields, which are held in a global variable file until the data is compelete and the written. Is it me over pushing ADO or the machines? Should I use a more efficeient way of writing to the database?
Should I store the data to a temp file during the data collection cycle?
Please help it never seems to do it on the development machince.
Also as an additonal point sometime the data is not written at a
ll which is even more of a problem.

Am I going about writing to databases all wrong?

Any help would be greatfully received.

Best regards

Adam
0 Kudos
Message 1 of 6
(3,067 Views)
This sounds like a race condition!

This usually results from having multiple writers to an un-protected data structure. What happens is old info gets re-written over new data.

Without seeing your code it will be difficult to say more.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 6
(3,067 Views)
This is the database file which I am using.

Probably very rubbish code, but it sort of works.

Thankyou for any advice you give.
0 Kudos
Message 3 of 6
(3,067 Views)
Ben wrote in news:50650000000500000044140100-1042324653000
@exchange.ni.com:

> This sounds like a race condition!
>
> This usually results from having multiple writers to an un-protected
> data structure. What happens is old info gets re-written over new
> data.

The best (and easiest) way I have found to avoid race conditions, without
unnecessarily sequencing different .VIs by using a non-reentrant SubVI, is
to use Queues for the data handling. Use a Queue to modify the Global
variable, where the Queue has a a data type of a single record. Then
simply push the data on to the Queue as it becomes available, and as there
is only one VI actually reading/writing the Global, no race conditions
should exist.

Andrew
0 Kudos
Message 4 of 6
(3,067 Views)
Errr Help!!!

I sort of understand what you mean, but I have no idea of how to go about it.

Any more explination would be great.

Thankyou for your help.

Adam
0 Kudos
Message 5 of 6
(3,067 Views)
Go to the LabVIEW Zone on this web-site.

I believe under Learning Center (maybe wrong) you want to find "DR VI".

A past article talked about globals etc.

Start with that.

Now! back to work for Ben.
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 6
(3,067 Views)