private void button1_Click(object sender, EventArgs e)
{
string dbPath = @"D:\历年高考分数.db";
string sq = @"Data Source=" + dbPath;
m = new SQLiteConnection(sq);
m.Open();
SQLiteDataAdapter mAdapter = new SQLiteDataAdapter("select para1,para2,para3 from 下拉框", m);
DataSet ds = new DataSet();
mAdapter.Fill(ds);
DataTable dt = ds.Tables[0];
![图片说明](https://img-ask.csdn.net/upload/201907/10/1562768984_4575.png)
comboBox1.DataSource = dt;
comboBox1.ValueMember = "para1";
m.Close();
}
private void InitCityByProvince()
{
//comboBox2.Items.Clear();
string dbPath = @"D:\历年高考分数.db";
string sq = @"Data Source=" + dbPath;
m = new SQLiteConnection(sq);
m.Open();
SQLiteDataAdapter mAdapter = new SQLiteDataAdapter("select para1,para2,para3 from 下拉框", m);
DataSet ds = new DataSet();
mAdapter.Fill(ds);
DataTable dt = ds.Tables[0];
comboBox2.DataSource = dt;
comboBox2.ValueMember = "para2";
m.Close();
}
protected void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
InitCityByProvince();
}