04-14-2016 09:09 AM - edited 04-14-2016 09:11 AM
hello!
I would like to get a timestamp with the database connectivity toolkit.
from sqlserver, my datetime is written like this:
format: datetime
content: 2016-01-01 00:00:00.000
The VI I'm using looks like this:
the typedef cluster entering into the function "database variant to data" has the properties below
but when I'm launching it, the function " the function "database variant to data" returns this error, translation "datatype in the variant is incompatible with the datatype at the input of the function
I f I edit my typedef and replace string from datetime, everithing is working, the boleans return the correct values, but time returned in the string is just date, not time.
can you help me?
04-20-2016 11:29 AM
Hello,
It seems the datatype datatime is not a string, it's a specific datatype for LabVIEW.
In my point of view, you have to use a function to convert the datatime in tring and send a string to the database (see example bellow)
String is a classing datatype easily shared by different programming language.
If you want to change the parameter of the time in the string, refer to the help of the function.
Best Regards,
04-20-2016 02:08 PM - edited 04-20-2016 02:09 PM
The datatypes need to match exactly or they will not cast correctly.
You could use this scripting VI I wrote some time ago to have LabVIEW create a cluster for you based on the elements of a specified table.
You can save the cluster as a typedef and then use that the create an empty array to use as the input to the Database Variant to Data function.
https://decibel.ni.com/content/docs/DOC-19512
You may find that the datetime is being stored in your DB as a string, which means you would need to convert it yourself from string to datetime.