LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

SQL DATETIME DBBindColDouble - trouble

Hi,
I'm using LW 8.5, SQLToolkit 2.06 and having troubles getting DATETIME - Values out of MYSQL
5.xx MyODBC 5.xx (latest versions for both).

I may use DBBindColDouble to bind a double variable to the MySQL-DATETIME columns but only the DATE part of it is retrieved (MS-Excel -Style).

My Problem is: I want to do some calculations on the DATETIME vars including seconds/minutes.

thx in advance

PS:
i've tried   DBGetColVariant(hndStmt,1,&vVal1); CA_VariantGetDate ( &vVal1, &dDate1 ); with the same result.
i wonder where CVI swallows the TIME part, cause when i do DBBindColChar( ... "yyyymmddhhiiss") everything is whoopy, but i DON'T want to do
the strDate to double conversion myself.


0 Kudos
Message 1 of 4
(3,682 Views)
Hi,

when you bind to a double, what exactly do you get? For instance, if the date time in MySQL is 3/July/2002 3:00:00 PM, what is the value of the double?
If it truely is in MS-Excel style, the double should contain both the date information and the time information and should come in as 37440.625.
What do you get?

I am going to try this on my machine as well, but I'm having some trouble with the MySQL part, so while I'm doing that, if you can respond to my question, it might get us to an answer faster.

Thanks,
Ralf N.

0 Kudos
Message 2 of 4
(3,645 Views)
The problem is the lack of decimals = the time - part of the double  is missing.

Following your example, but without checking in excel, i get only 37440.000000.


0 Kudos
Message 3 of 4
(3,633 Views)

Hi,

 

I'm very sorry for the late reply. - I escalated your question 3 times to America and they sent me the answer today...

(Don't know what happened there. Usually it takes only one, at most a few days...)

 

 

They tested the following code-snippet:

 

int main (int argc, char *argv[])

{

int myConnectionHandle;

double datetimeDouble;

int status;

int myStatement;

 

 

myConnectionHandle = DBConnect("DSN=USERDSNtest;UID=root;PWD=root":smileywink:;

 

myStatement = DBActivateSQL(myConnectionHandle, "select * from testtable":smileywink:;

 

DBBindColDouble(myStatement,2, &datetimeDouble, &status);

 

DBFetchNext(myStatement);

 

 

return 0;

}

 

The datetimeDouble variable contained both the date and time in the form xxxx.xxxx .  I am not sure why your customer was unable to retrieve both the date and the time with the DBBindColDouble(), but we were unable to reproduce this on our end. 

 

 

Please check this at your System. - I hope it will work for you too. 

 

 

With best regards from Germany

 

Ralf N.

Applications Engineering 

 

0 Kudos
Message 4 of 4
(3,518 Views)