This is my current code

SqlConnection con = new SqlConnection("Data Source = .\\SQLEXPRESS; Initial Catalog = Library; Integrated Security = True");
            string query = "select author_name from author";
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = con;
            cmd.CommandText = query;
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = cmd;
            DataTable dt = new DataTable();
            da.Fill(dt);

            foreach (DataRow dr in dt.Rows)
            {
            }

ListItem is not being recognized.. How to do this?

I tried to add

checkedListBox1.Items.Add(dr["author_name"].ToString());

and it seems working now..?

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.