Jump to content

How to convert LV TimeStamp for Field Date SQLANYW


Recommended Posts

How to can convert one value type LabVIEW data TIMESTAMP ( Controls->Numeric->Time Stamp Control )  for inserting this value into one TIMESTAMP data field for DataBase SQLAnywhere 9.

1523[/snapback]

Leopold,

If you could provide more information about the datatype expected by the call into the SQLAnywhere code, that would be helpful.

Until then, I have attached a VI (saved in LV7.0) which demonstrates conversion from the LV timestamp into an OLE Variant (used by ActiveX-based database tools, such as NI's Database Connectivity Toolkit). The VI also converts the OLE Variant back to the LV datatype. It may or may not be relevant as an example, depending upon your call interface.

Hope this is useful to you. If not, describe your code in greater detail and perhaps someone on the user group can determine what needs to happen.

Best regards,

Dave

Download File:post-195-1093285147.vi

Link to comment
  • 2 months later...
Leopold,

If you could provide more information about the datatype expected by the call into the SQLAnywhere code, that would be helpful.

Until then, I have attached a VI (saved in LV7.0) which demonstrates conversion from the LV timestamp into an OLE Variant (used by ActiveX-based database tools, such as NI's Database Connectivity Toolkit).  The VI also converts the OLE Variant back to the LV datatype.  It may or may not be relevant as an example, depending upon your call interface.

Hope this is useful to you.  If not, describe your code in greater detail and perhaps someone on the user group can determine what needs to happen.

Best regards,

Dave

1526[/snapback]

HI, converting labview timestamps to a database format is not easy. The first thing to do is to convert the labview timestamp to a DBL so you have the number of seconds sinds a certain startdata. Now you have to find some documentation about the startdate of the database you are using. substract/add the difference between labview and your database to have a correct value.

Please note that the timestamp field is not always a real date/time it also could be a syncronisation bit as used in the SQL SERVER timestamp implementation.

You might consider using a float;real for timestamp control.

You can also have a look at the New LabVIEW Database Toolkit at www.tm-solutions.nl/eng

Greetz

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
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.