LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Insert NULL into DB with Database Connectivity Toolkit

Thanks but...

My VI is working correctly since five years, what you see is an extract of my software, the date you is already teh result of a convertion of a timestamp control.

I'm only try to modify my VI inserting a NULL instead of 1900-01-01 00:00:00 for the last parameter.

The first date you see is in the correct format, 2001-10-10 even if it has no explicit time is accepted.

The only problem with my VI is the NULL string, if I replace it with an empty string, it gives no error, but it insert a 1900-10-10 00:00:00 value in the database, instead I need a NULL value.

0 Kudos
Message 21 of 25
(961 Views)
I've tried using a Variant to data with the DB NULL VI, now it gives no error but it returns an empty string so a 1900-01-01 value in the DB that is not what i need.
0 Kudos
Message 22 of 25
(952 Views)

I expect your issue is because you are using the DB Tools Insert Data.vi.  There's a lot of overhead and conversion of input parameters (so assumptions of what you are trying to accomplish) in there, and I doubt your INSERT statement is coming out right.  If you open the VI, you should be able to I always just use DB Tools Execute Query.vi under the Advanced tab.  I know exactly what SQL I am trying to perform, and it makes situations like this much easier to debug.

0 Kudos
Message 23 of 25
(946 Views)

Hello geppoline,
Use the probe tool and take a look inside the VIs and sub-VIs. For example C:\Program Files (x86)\National Instruments\LabVIEW 2013\vi.lib\addons\database\Command.llb\Cmd Create Parameters.vi; C:\Program Files (x86)\National Instruments\LabVIEW 2013\vi.lib\addons\database\Parser.llb\DB Tools Generate Parameter.vi

By the way if the default value of the colunm is NULL, you can simply not write that value (delete the Colunm name and the value the value-cluster.

0 Kudos
Message 24 of 25
(938 Views)

..the problem is that I need to make a very big workaround to solve this way.
Not inserting that column value is quite complicated 'cause it is inside a bigger VI that use the fixed number of fields and fields position to make some other operations in next subVIs

At the moment, analysing the creat eparameters VI, it seems it recognize Null as a string so it put apices in the parameter, but i can't find a way not to put them.

 

 

0 Kudos
Message 25 of 25
(926 Views)