teoh <[EMAIL PROTECTED]> writes:

> create table each_transaction(datetime int);
>
> insert into each_transaction values( datetime('%s',
> 'now'));
>
> this is how I create table and insert the
> strftime('%s', 'now'). But when I did query with
> sql3_plus. 
>
> sqlite3::reader reader=con.executereader("select *
> from each_transaction;");
> while(reader.read())
> {cout << reader.getcolname(0) << ": " <<
> reader.getstring(0) << endl;  }
>
>
> I get output like this:
>
> datetime: á "     <----- invalid 
>
>
> Any idea?  coz If I change to
> datetime('now','localtime');
> everything is ok. I only cannot use strftime('%s',
> 'now') for "insert" statement.

It appears that you are getting back an integer but not displaying it as an
integer.  You have declared datetime as an integer in your CREATE TABLE
statement.  (Maybe you wanted to declare it as TEXT?)  I haven't used C++ with
sqlite.  Can you do reader.getint(0) instead of reader.getstring(0)?

Derrell

Reply via email to