1,105,363 Community Members

checkedlistbox storing values in database

Member Avatar
Posting Whiz
362 posts since Jul 2010
Reputation Points: 4 [?]
Q&As Helped to Solve: 2 [?]
Skill Endorsements: 0 [?]

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.

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?

Member Avatar
Junior Poster in Training
99 posts since Aug 2010
Reputation Points: 10 [?]
Q&As Helped to Solve: 22 [?]
Skill Endorsements: 0 [?]

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.


This article has been dead for over three months: Start a new discussion instead
Start New Discussion
Tags Related to this Article