![]() |
| ||
| sql "insert into" question 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! |
| ||
| Re: sql "insert into" question 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 Hope that helps. |
| ||
| Re: sql "insert into" question Maybe I missed the picture ... You want to insert into table albums ... insert into albums (albumID, cover_path) values ('%s', %d)
Maybe? |
| ||
| Re: sql "insert into" question UPDATE is what I think I need. I will try it out tonight and see what happens. Thanks |
| ||
| Re: sql "insert into" question yep, the UPDATE statement was it. Thanks a lot! |
| All times are GMT -4. The time now is 4:10 pm. |
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC