12-15-2015 06:05 AM
Create a recod and Update a record is not problem. It works but i want to update if records exists else create a new record. is this possible using DB tool.?
12-15-2015 06:20 AM
It is, using a custom SQL query - it depends on what database you are using (e.g. MSSQL/MySQL) - I'm sure if you google "insert or update query" you will find lots of answers - it's probably possible in most database engines.
12-15-2015 07:07 AM
Thanks for your reply. I am using MS Access and DB toolkit from Labview..
12-15-2015 07:18 AM
The DB toolkit can execute any SQL query(ies) on your database. You just need to find out the appropriate query in MS Access. If there isn't a built in option in MS Access databases (in MySQL there is a DUPLICATE KEY option which allows you to insert/update in one query), you can always do a SELECT statement to see if the record exists and then either INSERT or UPDATE in the second query.
12-15-2015 09:19 PM
12-15-2015 10:44 PM
Thanks for ur reply. I understood your points. I did the same logic(select query and check the records and if it s not there create new record) but would like to use in single logic. It will be available in other programming.
12-16-2015 01:11 AM
11-16-2018 10:02 AM
I understand this post is old, and this is my first post. However, I'd like to share a solution that I created for my particular application.
Program Background
I have configuration files (aka files that have the performance tolerances) that I want to upload to a database (viewed from MS Access). I want to check if the user specified configuration already exists in the database. If it doesn't exist, the configuration is inserted into the respective table. If it does, then ask the user if they want to update the database.
Solution
1. This code is a portion of a much larger program that creates a test database, but I've isolated this portion to share with whoever may find this helpful.
2. Everything is in the attached .zip.
3. This is my first time working with Labview, so if you see something that makes you go "what the hell is he doing?", please let me know 🙂
4. Default system directory is user desktop. Please keep everything in the folder together, or you will need to update links, etc.
5. When the table is updated, I update every column in the table because that's what I wanted for this particular application.