关于在eclipse中运行出错的一个小问题 Unknown column 'android' in 'where clause'
2014-11-02 10:04
645 查看
昨天晚上在查找数据库中的一个元素 " android ' 一直报错 Unknown column 'android' in 'where clause',后来,摸索了一个小时,终于搞懂了
原来是sql语句写错了 错误的sql语句:
String sql = "SELECT * FROM tb_major WHERE major=" + majorname;
正确的:String sql = "SELECT * FROM tb_major WHERE major=' " + majorname+" ' ";
原来我的数据库中存的major是个字符串类型,所以在查找的时候也应该以字符串的类型查找;
原来是sql语句写错了 错误的sql语句:
String sql = "SELECT * FROM tb_major WHERE major=" + majorname;
正确的:String sql = "SELECT * FROM tb_major WHERE major=' " + majorname+" ' ";
原来我的数据库中存的major是个字符串类型,所以在查找的时候也应该以字符串的类型查找;
相关文章推荐
- java.sql.SQLException:Unknown column 'admin' in 'where clause'错误问题
- Unknown column '??????' in 'where clause'问题
- Unknown column 'ORGANIZATION_BANK' in 'where clause'
- SQLSTATE[42S22]: Column not found: 1054 Unknown column 'tbl_contact' in 'where clause'.
- Unknown column 'rownum' in 'where clause'解决方案
- Unknown column '安妮宝贝' in 'where clause'
- Android 编译2.6.36的kernel akm8975 driver时unknown field 'ioctl' specified in initializer的问题
- eclipse运行android程序提示“Please ensure ..... /sdk/platform-tools/adb' and can be executed”问题的解决
- 低级错误之 Unknown column 'XX in 'XXclause'
- Column 'id' in where clause is ambiguous
- mysql 一个较特殊的问题:You can't specify target table 'wms_cabinet_form' for update in FROM clause
- mysql下出现Unknown column 'xx' in 'on clause'的完全解决方法
- Column 'Email' in where clause is ambiguous
- 关于eclipse下运行maven build报 No plugin found for prefix 'jetty' in the current project and in the plu gi
- mysql 一个较特殊的问题:You can't specify target table 'wms_cabinet_form' for update in FROM clause
- 关于Eclipse导入Android工程出现couldn't write file:*********/.classpath的问题
- eclipse进行android,运行就提示ERROR: Unknown command 'crunch'
- 数据库异常:“Column 'CODE' in where clause is ambiguous”
- Column 'id' in where clause is ambiguous
- mysql 一个较特殊的问题:You can't specify target table 'wms_cabinet_form' for update in FROM clause