Jump to content

Write just one column in a MS Access database with LV.


Dario24

Recommended Posts

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

Link to comment

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 :rolleyes:).

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.

Link to comment
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.

Link to comment

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.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.