Showing results for 
Search instead for 
Did you mean: 

sql database

I have used the LV Database toolkit to save data to a predefined MS Access table which worked fine. happy smiley
However when I set the first column in the table to be auto-indexing and tried to use the feature in the write to database VI, where you can specify columns to wrte to (I think??), problems occured. sad smiley
The first column name was not included in the string table as I wanted the saved data to ignore the first column and just place the data in the remainig columns specified. But I keep getting a column empty error.
I have attached the vi  used and think that I am probably missing something obvious. The access table has column headings that match the string table but the first column heading is Test Data Index.
Labview version used 8.2
Labview Version 8.5
Labview Version 8.6
Labview Version 2014
0 Kudos
Message 1 of 4

You could execute a SQL command instead. This way lets the autoincrement field do its stuff automatically.

When table names have spaces in them you need to enclose them in [ ] brackets. I always avoid using names that are reserved words in SQL like Date and therefore ambiguous.

I have followed my nose and provided an example attached.

Can you try it and let me know if works?

Hope this helps


Message 2 of 4

Thanks David, your VI works fine.

I should have realised that DATE would cause a problem being an SQL operator. I have also put square brackets, as you suggested around the column names in the string table I created and that now works but it still did not like the string name DATE, as expected I guess.

 In your VI you have used the sub VI 'DB Free Object. Being new to the toolset, would my version without this cause problems? I think your VI is probably more flexible as you are using SQL commands rather than depending upon the pre built LV VI functions. I have got some books coming on Database design so I think a few weeks reading might be in order!!

Thanks for your help, greatly appreciated,


Labview Version 8.5
Labview Version 8.6
Labview Version 2014
0 Kudos
Message 3 of 4

I can't see the code, but in general, you should definitely free references.

The LV DB toolkit communicates with the DB through ActiveX, which is an external resource, so LV can close references automatically only when you stop the top level VI. If you don't close the references, you will get a memory leak. This might not be important for something that runs for a short time, but if your app runs for a long time (as DB related apps tend to do), your application will start running slower and slower and eventually crash.

Don't underestimate the built-in functions - they also simply create SQL queries behind the scenes (you can see that if you open them), but the real magic in them is the parser which can parse the different data types and accept any data type (see the Insert Data VI for an example).

Try to take over the world!
Message 4 of 4