I have checkedlistbox that is being populated at runtime by a dataset. Whenever I tried checking multiple items, only one is being stored in my database.

Here to explain more clearly.

SQL
I have two tables, book table and author table which has its own id. My book table has an author field and which i'll get in author table that is on a form of a checkedlistbox in visual studio.

Visual Studio C#
I have a form for adding book that has a checkedlistbox which is being generated at runtime by a dataset which is the author table at sql. I want to store the items that are checked and put it in book table. What is the best possible approach for this?

Have another column set to the equivalence of a bool, in this case an enum() though I'm not sure if all database types support this or if they all use the same name. If not, just use a character or text field type or even an int/byte type and define it that way.

True/1 it's checked, false/0 it's not. A reasonably simple approach I'd think :) though there might be a better way that I don't know about.

[Links]
http://dev.mysql.com/doc/refman/5.0/en/enum.html
http://office.microsoft.com/en-us/access-help/add-or-change-a-lookup-column-HA010163773.aspx

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.