12-11-2013 06:43 AM
Hi There!
I am using the Database Connectivity Toolkit to perform various tasks with my MySQL database.
I am successfully able to create tables, log data, view data etc - no problems there.
However, there is something I need to do when creating a table that has me stumped. I need a column in one of my tables to be auto-incrementing (Ie, no duplicates).
It is possible to set this through a program like the MySQL Workbench but it doesn't appear possible to do through LabVIEW.
Is it possible through LabVIEW? And if so how? Maybe its a setting I'm missing or should I be sending a query using one of the functions in the toolkit?
If you need any more info just ask.
Thanks in advance.
Solved! Go to Solution.
12-11-2013 07:54 AM
I have no specific experience with MySQL, but generally, when inserting into a table with auto-incrementing columns, the insert query should NOT include that column, as its value is determined automatically.
If you're talking about creating a table with an auto-inc column, then I'm assuming you're using the create table VI. If you open the VI, you will see that it simply builds an SQL query. Look up the relevant SQL syntax for making a column auto-inc and then create a copy of the VI and modify it to allow you to specify that on the column using that syntax.
12-11-2013 08:07 AM - edited 12-11-2013 08:36 AM
Hi tst,
You make a good point. I cracked open the Create Table VI and it makes sense. I'll build the query myself and run that.
[EDIT: After a bit of juggling with the syntax it worked ]
Thanks