LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Delete a record from a table in a Database with Database Connectivity

I can't find the function from the Database Connectivity library that allows me to delete a record from a table of the database. I tried to use DB Tools Free Object.vi function but this one deletes only the table created with a query.
 
Thankyou
0 Kudos
Message 1 of 9
(4,524 Views)

I have no idea if there's a separate function in the toolkit but you can execute a SQL command to do it. The syntax is:

DELETE [from] table name [WHERE clause

Example: DELETE testres WHERE meas < 0.0

0 Kudos
Message 2 of 9
(4,504 Views)
Thank you for your answer, but I'm looking for a specific function that delete a record identified from a recordset reference out.
0 Kudos
Message 3 of 9
(4,489 Views)
If you look inside the VIs that work with recordsets, you will see that the recordset is actually an ActiveX object (or more specifically, an ADO object). As such, it has ActiveX methods, one of which is Delete, which will presumably help you. Did you try using it?

___________________
Try to take over the world!
0 Kudos
Message 4 of 9
(4,483 Views)
Hi,
I have the same problem to delete a record from a table in a Database. I couldn't understand your answers very well. Can anyone give some more details? If you already have got the solution, could you let me know? Thank you very much!
Jane 
0 Kudos
Message 5 of 9
(4,456 Views)
As Dennis said, you can use an SQL query (read up on SQL to understand more about how this works). The advanced palette includes the DB Tools Execute Query VI which will do what you need if you give it the delete command. Look at the examples in the example finder (Help>>Find Examples) to see how the DB VIs work.

___________________
Try to take over the world!
0 Kudos
Message 6 of 9
(4,448 Views)

I have used the sql query as described above and it works fine with access DB and the DB toolkit, the free object vi only deallocated a recordset's references this will noty alter the database since the record is a copy of the databases information.  The SQL delete function is very versatile and you should be able to delete records with no problem.

 

Paul

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 7 of 9
(4,444 Views)

If I want to delete the nth record, I have to first move the recordset to nth location, then use the SQL delete, but there seems no SQL execute vi for recordset. The record to be deleted is not fixed value, it is a control.

Thanks, Jane

 

0 Kudos
Message 8 of 9
(4,431 Views)
Get the unique key from the nth record in the record set then use this value to write your delete SQL command.
 
Paul
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 9 of 9
(4,402 Views)