Click here to Skip to main content
15,124,736 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to fetch data from MS-Access database in window form datagridview based on item selected in checkedlistbox.
I am using OLEDB command to connect databse Not using SQl or Sql connection.
Data in database in string format.

What I have tried:

Label1.Text = "";

for (int c = 0; c < CheckBoxList1.Items.Count; c++)


if (CheckBoxList1.Items[c].Selected)


Label1.Text += CheckBoxList1.Items[c].Text;

and I am not sure what should i try
Updated 17-Nov-19 2:09am
Gerry Schmitz 16-Nov-19 10:22am
How did you populate the "checkedlistbox"? Seems like there would be a connection there.
Member 13132705 16-Nov-19 15:43pm
Yes there is OLEDB connection.
Member 13132705 16-Nov-19 11:04am
Yes there is OLEDB connection.
Maciej Los 16-Nov-19 13:08pm
Use "Reply" widget to inform other member about your comment.

1 solution

Loop through your checkboxes and for each one that is set add the appropriate part of your OLEDB statement.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900