Sep 1, 2009 11:40 AM
insert current date & time?
-
Like (0)
Hello Everyone.
Im creating a small air app using flex builder, im using Sqlite3 for persisting data, but im stuck in something really simple i want to insert the current time and date into a table.
The row in question is built like this:
lastMsgSent TIMESTAMP
If i try to do directly in sqlite i can do something like:
insert into myTable(lastMsgSent) values(datetime('now','localtime);
and it works like a charm. If i try to do this from flex it breaks. with
Error #2044: Unhandled error:. text=Error #3132: Data type mismatch.
So then i tried with a little AS3 to create the date/time string
var df:DateFormatter = new DateFormatter();
df.formatString = "YYYY-MM-DD J:NN:SS";
trace(df.format(myDate));
var a:String=myDate.toLocaleDateString();
insertStar_query.parameters = [df.format(myDate)];
insertStar_query.execute();
And it still breaks. with:
Error #2044: Unhandled error:. text=Error #3132: Data type mismatch.
Now im stuck. Weird thing is that if i do it manually from sqlite it works...
Im pretty sure there must be an easier way to do this but im really new to this. Any input is welcome!
Thanks!
Alex
Ok i was able to insert the date using datetime('now','localtime) but i had to go from TIMESTAMP to DATETIME on the table.
It still feels kind of a hack that it does work from sqlite and not from flex... any ideas why this might be?
North America
Europe, Middle East and Africa
Asia Pacific
Copyright © 2011 Adobe Systems Incorporated. All rights reserved.
Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy (updated 07-14-2009).