Is it possible to fill a checkedlistbox with items from an sql database?
<p>Sorry if this is a stupid question! I'm very new to coding and only have limited access to the internet whilst at work, I was just wondering if this is possible? and If so do you have a useful link for me to read over?</p>

<p>A quick overview of what I'm trying to do.</p>

<p>I have form1 and form2, form1 has a datagridview box that pulls data from the database, when I click on a cell it opens form2, which has a checklistbox which I want to now put code in so it pulls the data from a specific column and checks a box if the cell that was clicked applies to it.</p>

<p>Go easy on me if this question is stupid ^^, thanks in advance!</p>

<p>Some code I have produced so far! Which pulls the boxes from the database, but I also need to check the boxes too..</p>

<pre><code>SqlConnection con = new SqlConnection("=");
            con.Open();
            string query = "select ID from dbo.report";
            SqlCommand cmd = new SqlCommand(query, con);
            SqlDataAdapter sda;
            DataSet ds = new DataSet();
            sda = new SqlDataAdapter(cmd);
            sda.Fill(ds);
            DataTable dt = ds.Tables[0];
            foreach (DataRow datarow in dt.Rows)
            {
                checkedListBox1.Items.Add(datarow["ReportID"]);
</code></pre>

<p>Edited: put current coding in.</p>