AMImpl 中 执行sql语句的例子
来源:互联网 发布:手机淘宝开店好吗 编辑:程序博客网 时间:2024/06/05 19:48
执行更新语句的例子
public void updateExamHourFromUser(){ String sql = " update exam_single s set s.finish_hours = (select sum(h.fill_hour) from exam_single_hour h where s.id = h.exam_single_id ) "; ResultSet rs = null; DBTransaction db = this.getDBTransaction(); PreparedStatement ps = db.createPreparedStatement(sql, 0); try { ps.execute(); db.commit(); ps.close(); } catch (SQLException ex) { ex.printStackTrace(); } this.getExamSingleView2().executeQuery(); return ; }
执行查询语句的例子:
public boolean isExamUserExistInProject(String projectId,String userId){ String querySQL = " select * from exam_single t where project_id = '"+projectId+"' and user_id = '"+userId+"' "; ResultSet rs = null; DBTransaction db = this.getDBTransaction(); boolean flag = false; // PreparedStatement ps = db.createPreparedStatement(querySQL, 0); try { rs = ps.executeQuery(); while (rs.next()) { if( rs.getString("Id")!=null){ flag = true; } } } catch (SQLException ex) { ex.printStackTrace(); db.closeTransaction(); } return flag; }
0 0
- AMImpl 中 执行sql语句的例子
- sql语句中having的使用例子
- Sql 语句中执行 定义变量的SQL语句
- SQL中case语句的执行
- sql中执行变量语句的内容
- SQL中SELECT语句的执行顺序
- SQL中SELECT语句的执行顺序
- oracle 中sql 语句的执行过程
- ibatis中显示执行的SQL语句
- SQL 中 SELECT 语句的执行顺序
- magento 中查看执行的sql语句
- SQL中SELECT语句的执行顺序
- SQL中SELECT语句的执行顺序
- SQL中SELECT语句的执行顺序
- sql中语句的执行顺序
- SQL中Select语句的执行顺序
- SQL中SELECT语句的执行顺序
- SQL 中 SELECT 语句的执行顺序
- 网站配色,CSS主色调配色方案
- ContentProvider(2):分享自己APP的数据
- FND_Setup
- RTP/RTCP视频数据传输
- osg demo11 draw shapes
- AMImpl 中 执行sql语句的例子
- C++开源库,欢迎补充。
- ContentProvider(3):分享自己APP的数据
- split方法使用的经验。
- android中图片的三级cache策略(内存、文件、网络) 一
- ExtJS 4.2 介绍
- synergy使用
- 南邮-2024-入栈序列和出栈序列
- linux下IPTABLES配置详解