C# ACCESS 查询提示“至少一个参数没有被指定”问题

 错误的SQL指令如下:

    sqlStr = “select * from  tb_userInfo where userName=” + userName;    //错误的 sql 指令

正确的SQL指令如下:

    sqlStr = “select * from  tb_userInfo where userName=‘’” + userName + “'”;    //正确的sql指令

错误原因:userName是文本格式 , userName 左右都须加单引号 ' 。

posted @ 2017-07-12 19:25  Waming  阅读(492)  评论(0编辑  收藏  举报