02-09-2013 01:05 AM
Hello,
I am using Lab Windows CVI 8.5 and also SQL TOolkit for my project. I am using DBMapColumnToChar function for mapping Date to the database. And for retrieving records I am using SQL Query as follows:
SELECT * FROM DBTable WHERE DATE_TABLE BETWEEN '%s' AND '%s'",cCurrentDate,cCurrentDate
I have given a drop down for selecting dates.
When I execute the query I am not getting the selected date values an instead I am getting some records for which the dates aren't selected...
Quick help needed for this..Thanks in advance
02-11-2013 01:36 AM
Can anyone help me!!! Its Urgent
02-11-2013 07:47 PM
02-13-2013 12:36 PM
Depending on the database, the date/time structure can be completely different from the structure in CVI. CVI uses the Windows format for time(), that is the number of seconds since 1900. The tm struct can break this apart into a date and time structure that is usable.
I am using MS Access for the databases and SQL toolkit. I finally ended up replace the date field with an INT field format, and then store the CVI time (gotten with time()) as an INT value.
Easy then to get a search range, store it a tm struct and then convert with mktime() to a calendar time to search with.
Hope this helps. The date/time thing is a never ending struggle.
Regards, David E.
02-13-2013 08:23 PM
Thanks David E,
But I found another way to sort this out,instead of MM/DD/yyyy,I am using yyyy/MM/DD,and I think this sorts out the problem. Waiting for the testing team's result...