在用C#写一个登录界面的时候,要判断用户名和密码是否在数据库中,然后做出反应。数据库用的access。执行到下面的时候出现了错误,指定转换无效。 string sql = string.Format("select count(*) from [User] where user_id='" + user_text.Text.Trim() + "' and password='" + pass_text.Text.Trim() + "'");
                using (OleDbCommand cmd = oc.CreateCommand())
                {
                    cmd.CommandText = sql;
                    count = (int) cmd.ExecuteScalar();                }在count = (int) cmd.ExecuteScalar();处出现了错误。错误提示:指定转换无效。希望大家指点下。