05-10-2017 07:45 AM
Hello everyone.
I am trying to include or delete the nth record of a table in a database (database connectivity toolkit).
Any ideas?
Thanks in advance.
05-10-2017 08:45 AM
@labviewette wrote:
Hello everyone.
I am trying to include or delete the nth record of a table in a database (database connectivity toolkit).
Any ideas?
Thanks in advance.
DELETE FROM [a table] WHERE [record] = "nth"
05-10-2017 09:16 AM
To elaborate on Jim's response:
05-10-2017 02:05 PM
Thank you both !
05-10-2017 03:43 PM
Dear Jim and aputman,
I am not getting this working yet. In the case of updating a record:
If I set the "DB Tools Update Data.vi" condition to be record='10' (for example) then I get error -2147217900.
If t set the vi's condition to be WHERE record='10' then I get error -2147217904.
05-10-2017 04:07 PM
We were being a bit facetious in our response by setting the condition to be record='nth'. In order for that to work, you have to have a table named "a table" (which is illegal because of the space...pick a meaningful table name), and the table should have a column named 'record' that has a datatype of char(3). If the datatype of your column is actually an INT, and you want to update all entries (or delete all entries) that have a 'record' value of 10, you need to remove the quotes (WHERE record=10). I screwed up in my image and left off the WHERE keyword.
What database engine are you using? Do you have a table created? Have you built a connection string that creates a successful connection in the Open Connection VI?
05-11-2017 02:09 AM
aputman is right.
I would like to add a possible insert code. Assuming you would like to update a whole row you can just use a cluster as input.
05-11-2017 08:02 AM
@labviewette wrote:
Dear Jim and aputman,
I am not getting this working yet. In the case of updating a record:
If I set the "DB Tools Update Data.vi" condition to be record='10' (for example) then I get error -2147217900.
If t set the vi's condition to be WHERE record='10' then I get error -2147217904.
Please share details about the table you want to update: name, fields & data types should get us started.
05-11-2017 10:14 AM
Here is an excerpt of the database. The table's name is "table".
How can I update or delete the last record when I do not know the ID?
I am aware that this is more of an SQL than a LabVIEW question.
05-11-2017 10:22 AM