Code Snippet
private void CarregaList()
{
using (SqlConnection connection = new SqlConnection(@"Data Source=.\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=SSPI;"))
{
using (SqlCommand command = new SqlCommand())
{
command.CommandText = "SELECT CustomerID,CompanyName FROM Customers";
command.Connection = connection;
connection.Open();
DataTable table = new DataTable();
table.Load(command.ExecuteReader());
checkedListBox1.DataSource = table;
checkedListBox1.ValueMember = "CompanyName";
}
}
}