LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically Auto-Incrementing in a MySQL table

Solved!
Go to solution
Highlighted

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.

0 Kudos
Message 1 of 3
(620 Views)
Solution
Accepted by topic author MikeP4000
08-27-2015 04:09 PM

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.


___________________
Try to take over the world!
Message 2 of 3
(610 Views)

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 Smiley Happy]

 

Thanks

 

 

0 Kudos
Message 3 of 3
(608 Views)