i have problem here regarding update data when i checked value in checklistbox control.
no problem when i want to insert data for the first time, but got problem when i want to update it where the previous data that i checked is still available, plus the latest data i checked. Thats means I got multiple data in my database.

example:
cat
lion
mouse

previous( cat) > i checked cat only

latest in my database, i got (cat,cat, mouse) when i checked mouse and cat.

thanks for the help.

Depending on the database you are working with, there are a number of options (or lack of).
If this is an SQL server I would handle the update/insert with a stored procedure. I believe it offers way more control and I find it easier, cleaner and less bandwith consuming to pass a value to the db and have the db do it's thing.

If you are using Access or don't know what a stored procedure is, then you either check if a record exists and decide what to do from there, or create a key, do the insert and if that fails due to key violation do the update (not the recommended way).

yes, i use stored proc to save in database, but i get confius when its relate to save data that get from checkedlistbox item..
i try to do when i choose multiple choices from checkedlist item, i do not want to stored it using comma , in database table. I would like to store 2nd data choosen from checked list box onto next line of database column.
i know i can use comma , to save the checked items, but i just want to try other method by saving 2nd item checked into new line instead of using comma.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.