LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting database records/recordsets from LabVIEW

I would like to manage database information with LabVIEW. Any guidance or sample VIs on deleting records or recordsets from data displayed in a listbox in LabVIEW?
0 Kudos
Message 1 of 4
(3,211 Views)
Is the data going to be stored in an external database such as Oracle? If so deleting record(s) in the database is simply a matter of formatting an appropriate statement in SQL.

If you are wanting to know how to manage the contents of listboxes, they are simply string arrays. To delete something from the listbox, read the Strings[] property delete the element you wish to drop and write the modified array back to the property.

The only tricky thing is to remember to also delete the corresponding element in the Symbols[] property--assuming of course you are using symbols.

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 2 of 4
(3,211 Views)
that's a good start, but a little more detail would be helpful. suppose you are choosing records that you've displayed in a listbox, and you've selected records 1, 3, and 6. How do you delete these records. It would seem to me that if you have a reference to a recordset you should be able to go to record 'n' and delete it. Is this possible? That's the crux of my question.
0 Kudos
Message 3 of 4
(3,211 Views)
Ok, if the database you're talking to was designed correctly the table you're reading data from should have a "primary key value" this is a field containing a unique identifier. Primary keys are typically integers because integers are faster to search and index--but they don't have to be.

When you are performing your select statement to retrieve the data, be sure to also read the primary key. Keep this column of data in an array that you can refer to.

Now, when your user selects one or more items to delete, the code looks up the primary keys for those items and formats an SQL delete statement to delete just those records.

If the data you are reading comes from several tables using a "join", the problem gets a little more difficult, but
the same basic technique should work, the SQL will just be more complex.

The worse case situation is if you are getting your data from what is called a "view". If that is the case, you will need to spend sometime with someone in your MIS department and workout exactly how to do the delete.

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 4 of 4
(3,211 Views)