On Thu, 17 Feb 2005 01:22:38 +0200, Asko Kauppi <[EMAIL PROTECTED]> wrote:
>
> Please help me refine the following SQL. I have pretty much all the C
> code in place, table creation & detection works, then.. brick wall.
>
> I cannot add a single small text string into the table. What am I doing
> wrong? Trying with the
> "UPDATE '%q' SET val=?2 WHERE key=?1;" string, where ?1 and ?2 and
> bound to text strings.
>
> SQLite says SQLITE_DONE, but so does reading the table (= no data).
> Also sqlite3 cmdline tool confirms the emptiness.
>
Asko,
I think your problem is that you are expecting UPDATE to insert a new record
into the table. It won't do that. UPDATE is used to modify columns of
records that already exist in the table. To insert new data into a table you
need to use the INSERT command.
CREATE TABLE ini (key, value)
INSERT INTO ini VALUES('my key', 'some value')
UPDATE ini SET value = 'another value' WHERE key = 'my key'
SELECT * FROM ini
HTH
Dennis Cote