LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

DateValue

Solved!
Go to solution

Having problem using SQL ToolKIT in CVI.

DBActivateSQL DateValue('2010/12/21  15:36:58') in CVI, the return value is '21'), while in MS ACCESS Query I get the full Date '2010/12/21' which is correct. What SQL Command should I use to get the full Date Value in CVI SQL ToolKIT.

 

Thank You.

0 Kudos
Message 1 of 3
(3,026 Views)
Solution
Accepted by topic author RONKEI

Correct me if I'm wrong, but it appears you're trying to make this exact call: DBActivateSQL(hdbc, "DateValue('2010//12//21 15:36:58')"); without using any dates actually stored in the database, is that correct? DateValue is a function that only works with Access databases (which it appears you're using). I'm not sure why it wouldn't work in CVI because that command should just be passed on to the database to handle. 

 

If the dates are actually stored in a table, then what you'd want to do is something like this:


hstmt = DBActivateSQL(hdbc, "SELECT timestamp FROM measure");

DBBindColChar(hstmt, 1, bufLen, buf, &status, "yyyy//mm//dd");

while(DBFetchNext(hstmt) == 0)

....

DBDeactivateSQL(hstmt);

 

If that's not what you want/need to do maybe a little more information or a copy of your exact code would help us figure something out.

Kevin B.
Message 2 of 3
(3,018 Views)

Hello Mr.' Kevin B.

Thank You for your Quick Reply. Your recommendation below works perfect, all I had to add to the line code was the format of "yyyy//mm//dd" instead of living it empty.

 

Thank you again,

 

Ron Keidar.

0 Kudos
Message 3 of 3
(3,013 Views)