Question : How should I format a Time value to insert it into a Visual FoxPro table from VBS

Hi All,
I have a working piece of code that inserts data into a VFP table but I now need to insert data into a "Time" field can anyone tell me the correct syntax?

My current code snippet looks something like this:
INSERT INTO tableA (Char1,Date1,Num1) VALUES ('Some Text', {12/07/2009}, 27.5)

I have tried:
INSERT INTO tableA (Char1,Date1,Num1,Time1) VALUES ('Some Text', {12/07/2009}, 27.5, {10:30:54})

which works except that in the table the time field shows: 10/30/54

I can give any further details that may help but this is the core of the problem

Thanks, Des

Answer : How should I format a Time value to insert it into a Visual FoxPro table from VBS

VFP does not know time data type. You may either use character data type or datetime data type. datetime will always contain both date and time part.

Datetime:
INSERT INTO tableA (Char1,Date1,Num1,DateTime1) VALUES ('Some Text', {12/07/2009}, 27.5, {01/01/1900 10:30:54})

Character:
INSERT INTO tableA (Char1,Date1,Num1,CharTime1) VALUES ('Some Text', {12/07/2009}, 27.5, "10:30:54")

To avoid date ambiguity I would recommend date constants in following format:
{^2009/07/12} or {^2009/07/12 10:30:54}
Random Solutions  
 
programming4us programming4us