0

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?

1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by AngelicOne
0

I tried to add

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

and it seems working now..?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.