private void Form1_Load(object sender, EventArgs e)
{
string constr = "server = ZX-201603011417\\SQLEXPRESS;user = wp;pwd = 2611709;database = serialPort";
SqlConnection conn = new SqlConnection(constr);
try
{
conn.Open();
string sql = "select * from Table_set where ID = '1'";
SqlCommand comm = new SqlCommand(sql, conn);
SqlDataReader dr;
dr = comm.ExecuteReader();
while (dr.Read())
{
comboBox4.Text = dr[6].ToString().Trim();
comboBox3.Text = dr[7].ToString().Trim();
comboBox6.Text = dr[8].ToString().Trim();
comboBox2.Text = dr[9].ToString().Trim();
comboBox1.Text = dr[10].ToString().Trim();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString(), "错误提示");
}
finally
{
conn.Close();
}
}