2017-02-22 111 views

回答

1

您希望从数据库中获得?然后你可以尝试这样的事情。

string Sql = "select brand from [Car]"; 
     SqlConnection conn = new SqlConnection(@"path_to_db"); 
     conn.Open(); 
     SqlCommand cmd = new SqlCommand(Sql, conn); 
     SqlDataReader DR = cmd.ExecuteReader(); 

     while (DR.Read()) 
     { 
      Invoke(new Action(() => ComboBox1.Items.Add(DR[0]))); 
     }