JDBC出现 "Unknown column 'xxx' in 'where clause' "
来源:互联网 发布:g41g42编程方法 编辑:程序博客网 时间:2024/04/29 16:54
我的sql语句为
String Name = "123";
String sql = "SELECT * FROM shops WHERE name="+Name;Statement statement = connection.createStatement(); //然后执行,报错
报错
"Unknown column 'xxx' in 'where clause' "
解决方案:更换Statement 为PreparedStatement,并使用setString(int i,String str)方法。
String sql = "SELECT * FROM shops WHERE name=?";try { PreparedStatement ps = connection.prepareStatement(sql); ps.setString(1,Name); ResultSet rs = ps.executeQuery();
阅读全文
0 0
- JDBC出现 "Unknown column 'xxx' in 'where clause' "
- Unknown column 'xxx' in 'where clause'错误
- 查询避免Unknown column ‘xxx’ in ‘where clause’
- 查询避免Unknown column ‘xxx’ in ‘where clause’
- 查询避免Unknown column ‘xxx’ in ‘where clause’
- mybatis查询报错 Unknown column 'xxx' in 'where clause'
- TP 框架解决Unknown column 'XXX' in 'where clause' 问题
- Unknown column 'rownum' in 'where clause'解决方案
- Unknown column '安妮宝贝' in 'where clause'
- Unknown column '??????' in 'where clause'问题
- Unknown column 'ORGANIZATION_BANK' in 'where clause'
- 中文乱码 unknown column in 'where clause'
- MySql报错原因分析Unknown column ‘xxx’ in ‘where clause’
- 数据库 —— 查询避免 Unknown column ‘xxx’ in ‘where clause’ 错误
- Column not found: 1054 Unknown column 'tl10709' in 'where clause'
- com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'cname' in 'where clause'
- com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column dd in where clause
- dedecms和ucenter整合时出现Error:Unknown column 'app3' in 'where clause'的解决办法
- 2017百度之星资格赛:1002. 度度熊的王国战略
- 统计字符串中有多少空格,数字,字母
- Python函数
- rtpsession详解
- Java递归实现算24
- JDBC出现 "Unknown column 'xxx' in 'where clause' "
- 《深度探索C++对象模型》第一章关于对象 摘录
- 第一个Hibernate程序配置带来的困境
- C# 上传文件并将路径存入数据库
- 解决a start job is running for dev-disk-by启动错误
- lua静态检查
- Mysql 0基础进阶之mysql介绍《01》
- 【消息队列MQ】各类MQ比较
- IntelliJ IDEA中Dependencies红色波浪线报错(缺少Dependency)的解决办法