I have an error with a combobox
My code:
SqlConnection conn = new SqlConnection();
try
{
conn = new SqlConnection(@\"Data Source=SHARKAWY;Initia
SqlConnection conn = new SqlConnection(@"Data Source=TOM-PC\sqlexpress;Initial Catalog=Northwind;User ID=sa;Password=xyz") ;
conn.Open();
SqlCommand sc = new SqlCommand("select customerid,contactname from customers", conn);
SqlDataReader reader;
reader = sc.ExecuteReader();
DataTable dt = new DataTable();
dt.Columns.Add("customerid", typeof(string));
dt.Columns.Add("contactname", typeof(string));
dt.Load(reader);
comboBox1.ValueMember = "customerid";
comboBox1.DisplayMember = "contactname";
comboBox1.DataSource = dt;
conn.Close();