Dario24 Posted November 1, 2013 Report Share Posted November 1, 2013 Hi, I'm using an access database to save the results of a functional test with Labview, I can write the database without problems, but I'm designing a software for the repair technician to see the data and save the cause and actions columns only for each result (Row in the Db). The problem is that I cannot find the way to write just certain columns on my database, basically I can't find the way to specify the "columns" on the Db Tools Insert Data VI. I have created a small table just with 2 columns to ID and DATE, just to try to write the date column. If I left the columns input on the VI with a empty array of course I can send and save both columns (VI attached), but I can find the way to write just the DATA column. Thanks in advance for your help. Db_ColumnWr_example.vi Quote Link to comment
LogMAN Posted November 1, 2013 Report Share Posted November 1, 2013 I can't give you any VI, as I have currently no system with the database connectivity toolkit installed, however I would build the query manually and supply it to the 'Execute Query' VI (I don't even know how all the other VIs work ). Your query should be: INSERT INTO Prueba ( date ) VALUES ( '%s' ); notice, that: 1) 'Prueba' is the table name 2) 'date' is the column name 3) %s should be replaced with the date you want to supply (use the 'Format Into String' VI) Your value must not contain a single quote as part of the value and ID must be set as auto-increment. I'm not sure if the value must be put into single quotes ( '%s' ) or double quotes ( "%s" ) ... Hope that helps. Quote Link to comment
Yair Posted November 5, 2013 Report Share Posted November 5, 2013 If I left the columns input on the VI with a empty array of course I can send and save both columns (VI attached), but I can find the way to write just the DATA column. If the columns input is empty or unwired, the VI will insert each element of the cluster into the corresponding column (by order). If the columns input isn't empty, it has to have the same number of elements as the cluster and each element has to correspond to the parallel element in the cluster, so in your case, the cluster should have one element and the array should have one element, which is "DATE". Of course, as also said, in such a case all the columns which you're not inserting must have auto-generated or default values, or the insert will fail. There should also be some examples of how to work with these VIs in the example finder. Quote Link to comment
Jordan Kuehn Posted November 5, 2013 Report Share Posted November 5, 2013 I tend to only use the DB VIs enough to allow me to write my own queries. Perhaps part of this is lack of documentation as Yair suggests, and perhaps it's also knowing SQL well enough to not want to bother with the silly VIs. I suggest, as does LogMAN, to write your own query and spend some time learning the basics. Doesn't take too much and you are armed with some powerful tools. Quote Link to comment
Phillip Brooks Posted November 6, 2013 Report Share Posted November 6, 2013 "date" is a reserved word and should not be used as a field name. http://office.microsoft.com/en-us/access-help/learn-about-access-reserved-words-and-symbols-HA010341461.aspx 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.