sql Statemente execute 返回值为false
来源:互联网 发布:seo房地产关键字 编辑:程序博客网 时间:2024/04/30 12:51
今天用jdbc写了一句sql语句,通过PreparedStatement对象来插入记录,发现一个奇怪的问题,我明明是成功插入记录,可是pstmt.execute()确返回的是false,狂晕中。
Java代码
- String
sqlText "insert= into problem(title, " + -
input, output, sample_input, " + -
hint, source, uploader) " + -
?, ;?, ?, ?, ?, ?, ?, ?)" -
PreparedStatement pstmt = - ......
- res
= pstmt.execute();
sun API 写道
public boolean execute()
throws SQLExceptionExecutes the SQL statement in thisPreparedStatement object, which may be any kind of SQL statement.Some prepared statements return multiple results; the executemethod handles these complex statements as well as the simpler formof statements handled by the methods executeQuery andexecuteUpdate.
The execute method returns a boolean to indicate the form of thefirst result. You must call either the method getResultSet orgetUpdateCount to retrieve the result; you must call getMoreResultsto move to any subsequent result(s).
Returns:
true if the first result is a ResultSet object; false if the firstresult is an update count or there is no result
Throws:
SQLException - if a database access error occurs or an argument issupplied to this method
throws SQLExceptionExecutes the SQL statement in thisPreparedStatement object, which may be any kind of SQL statement.Some prepared statements return multiple results; the executemethod handles these complex statements as well as the simpler formof statements handled by the methods executeQuery andexecuteUpdate.
The execute method returns a boolean to indicate the form of thefirst result. You must call either the method getResultSet orgetUpdateCount to retrieve the result; you must call getMoreResultsto move to any subsequent result(s).
Returns:
true if the first result is a ResultSet object; false if the firstresult is an update count or there is no result
Throws:
SQLException - if a database access error occurs or an argument issupplied to this method
Java代码
- if(pstmt.executeUpdate()
== 1) -
true; - else
-
false;
- sql Statemente execute 返回值为false
- SQL中execute操作返回false的问题
- mysql_query() ,注意返回值可能为true或false
- setOnTouchEvent 设置返回值为true 和 false的区别
- setOnTouchEvent 设置返回值为true 和 false的区别
- setOnTouchEvent 设置返回值为true 和 false的区别
- PreparedStatement execute执行插入成功却返回false
- PreparedStatement execute执行插入成功却返回false
- 为什么PreparedStatement execute执行插入成功却返回false
- Statement 的 execute(sql) 方法的返回值
- connection.prepareStatement(sql).execute()返回值boolen类型什么意思?
- Statement.execute() 返回值
- Struts2 execute返回值含义
- execute返回值的问题
- 检查字符串是否为电话号码或邮箱地址方法,并返回true or false的判断值
- 检查字符串是否为电话号码或邮箱地址方法,并返回true or false的判断值
- submit 的返回值为false 但表单还是会自动提交,怎么回事?
- [android] setOnTouchEvent 设置返回值为true 和 false的区别
- vsftpd用户配置
- LINUX知识点
- 盖茨给职场青年的十句警言
- Service通过广播Broadcast更新Activity UI
- IEEE802.10 网络安全技术咨询组
- sql Statemente execute 返回值为false
- Struct和Class的区别
- .NET 中的Cache
- [编程之美]求二进制中1的个数
- IEEE802.11 无线联网
- Extjs4 日期+时间选择控件
- OpenGL织梦之旅【第三章】第3节.实现截图功能
- ViewGroup学习之绘制过程
- Android短信监听器