Hello everyone!
I am writing a music database, and I need to insert into album table the path to its cover. However, not every album has a cover in its directory, so I've made an algorithm that only gets the albumID that has a cover. My question is - how can I insert value into one column in a row with a specific ID (or name)? I have tried this -

"insert into albums (cover_path) values ('%s') WHERE albumID=%d"

but it sais that theres an error at WHERE. How can I do this? I am using sqlite3 and C++. Thanks!

It sounds like you need to UPDATE rather than insert. Insert is used when the row doesn't exist at all. Update is used when you want to change the value of one or more columns in an existing row.

UPDATE albums 
SET cover_path = [I]Your_Path[/I]
WHERE albumID = [I]Your_Album_Id[/I]

Hope that helps.

Maybe I missed the picture ...

You want to insert into table albums ...

insert into albums (albumID, cover_path) values ('%s', %d)


UPDATE is what I think I need. I will try it out tonight and see what happens. Thanks

yep, the UPDATE statement was it. Thanks a lot!