我将combobox与数据库列绑定时出错?

时间:2013-07-31 10:59:57

标签: c# ms-access-2010

当我想将一个组合框与一个表格列绑定时,我在链接中有像图像一样的错误 这是图片链接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
        }

1 个答案:

答案 0 :(得分:0)

GetString()方法只接受int作为参数,您尝试使用字符串。 帽子对此如此怀疑?