当我想将一个组合框与一个表格列绑定时,我在链接中有像图像一样的错误 这是图片链接http://s23.postimg.org/btzj2n66j/Capture.png ------这是我的代码
private void bindcombo ()
{
OleDbCommand com = new OleDbCommand();
OleDbDataReader reader;
com.Connection = db_con;
db_con.Open();
com.CommandText = "select * from colleges";
reader = com.ExecuteReader();
while(reader.Read())
{
string combo_items = reader.GetString("college_name");
college_name.Items.Add(combo_items);//college_name is a combobox
}
答案 0 :(得分:0)
GetString()方法只接受int作为参数,您尝试使用字符串。 帽子对此如此怀疑?