LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Inserting Date/Time into MS Access Database

I'm trying to insert a timestamp into an MS Access Database using the Labview database connectivity toolset.  However, I keep getting an error saying that the parameter is in the incorrect format.  I'm using the "DB Tools Format DateTime String.vi", and it doesn't seem to be working.
Message 1 of 15
(9,488 Views)

Hello,

I don't have the answer to your question, but....

How did you get information to be written into MS Access from labview.

Thanks.

0 Kudos
Message 2 of 15
(9,472 Views)
If you are using this function to create the date but using SQL to put the date into the DB, this is probably the cause of your problem, because the VI adds a header to your string which is removed later by the parser. If you want to use this date in an SQL command, you should build it yourself or remove the header.
 
As for roboticstudent, just look at the examples in the example finder to see how to interact with databases.

___________________
Try to take over the world!
Message 3 of 15
(9,455 Views)
I tried it both ways.  I tried using the format date/time into string where it would return "11/7/05 8:22:34 PM", which I then tried to insert in to the DB, but to no avail.  I even tried various formats, changing the order of the numbers, etc., but it doesn't seem to work.
Message 4 of 15
(9,450 Views)

It would be easiest if you post your code, or at least an image of it.

Also, which error exactly are you getting? Is it possible you're trying to enter a string into a numeric field (for example)? If I define a date\time field in Access and then use Insert Data (with the LV formatted time string), it works fine.


___________________
Try to take over the world!
Message 5 of 15
(9,445 Views)

I use "Get Date/Time Sring.vi" to get the date & time as two seperate strings.

I then use "DB Tools Insert Data.vi" to write it to the database.

Both fields in the database are set to a Data Type of "Date/Time"

The Date Format is then set to "Short Date" and the Time Format to "Short Time"

 

Mike

 

Message 6 of 15
(9,442 Views)
I had some difficulty with this at first see the attached image of a vi which will querry ad MS access database and update the date of an entry, notice that I had to remove (parse) the header form the database time stamp.  It is written in LV7.0 with the DBtoolkit,
paul
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
Message 7 of 15
(9,441 Views)

Hi!,

Check this post by me:

http://forums.ni.com/ni/board/message?board.id=170&message.id=146148#M146148

If this doesn't help, we can try other options to work it out.

 

- Gurdas

Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
Message 8 of 15
(9,430 Views)
Thanks for the great suggestions!  The answer is so obvious, I didn't think of that before.  Just removing the "\01Date\Time\01" string made it possible to enter the information into the database.  FalkPl, your diagram helped a lot.

Brad

Message Edited by bburan on 12-09-2005 11:09 AM

Message 9 of 15
(9,422 Views)
I will try to ignore the fact that this is exactly what I said in my original response and instead give you some useful advice - when you run up against such problems, always try using probes and indicators to see that your inputs and outputs are what you expect them be. This would have let you see this yourself and will probably help you in the future.

___________________
Try to take over the world!
Message 10 of 15
(9,387 Views)