1个回答
展开全部
// 下拉框的下拉事件写下面代码
string connectionStr = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\Test.mdb";
using (OleDbConnection con = new OleDbConnection(connectionStr))
{
using (OleDbCommand cmd = new OleDbCommand())
{
con.Open();
cmd.CommandText = string.Format("SELECT ColumnName FROM TestTable ");
cmd.Connection = con;
using (OleDbDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
comboBox1.Items.Add(reader[0]);
}
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询