关于JDBC中的ResultSet的更新数据操作
2007-05-13 15:26
459 查看
今天通过看API DOC,才发现,还可以通过ResultSet来 更新数据
下面是API中的Code fragment:
rs.updateRow(); // updates the row in the data source
插入数据:
rs.moveToInsertRow(); // moves cursor to the insert row
rs.updateString(1, "AINSWORTH"); // updates the
// first column of the insert row to be
rs.updateInt(2,35); // updates the second column to be
rs.updateBoolean(3, true); // updates the third column to
rs.insertRow();
rs.moveToCurrentRow();
[/code]
下面是API中的Code fragment:
Statement stmt = con.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = stmt.executeQuery("SELECT a, b FROM TABLE2"); // rs will be scrollable, will not show changes made by others, // and will be updatable 更新数据 rs.absolute(5); // moves the cursor to the fifth row of rs rs.updateString("NAME", "AINSWORTH"); // updates the // [code]NAMEcolumn of row 5 to be
AINSWORTH
rs.updateRow(); // updates the row in the data source
插入数据:
rs.moveToInsertRow(); // moves cursor to the insert row
rs.updateString(1, "AINSWORTH"); // updates the
// first column of the insert row to be
AINSWORTH
rs.updateInt(2,35); // updates the second column to be
35
rs.updateBoolean(3, true); // updates the third column to
true
rs.insertRow();
rs.moveToCurrentRow();
[/code]
相关文章推荐
- JDBC中关于取出某个时间内的所有数据的操作
- 由DB2分页想到的,关于JDBC ResultSet 处理大数据量
- JDBC使用ResultSet卷动、更新数据
- jdbc在操作oracle海量数据的时候用ResultSet获取所有的返回数据出现内存溢出(转)
- jdbc关于操作Oracle时间数据解析
- JDBC ResultSet数据更新
- Java - 使用JDBC操作数据库时,如何提升读取数据的性能?如何提升更新数据的性能?
- JDBC :通过 Statement 执行数据表的更新操作
- 关于ViewGroup 中listview 和GridView数据不能动态更新的解决
- 关于Oracle数据中日期时间的操作
- 使用JDBC-ODBC操作Access数据
- 关于ajax的页面加载操作防止脏数据的产生
- 稳扎稳打Silverlight(57) - 4.0通信之WCF RIA Services: 概述, 通过 DomainDataSource 实现数据的添加、查询、更新和删除操作
- 稳扎稳打Silverlight(57) - 4.0通信之WCF RIA Services: 概述, 通过 DomainDataSource 实现数据的添加、查询、更新和删除操作
- 稳扎稳打Silverlight(57) - 4.0通信之WCF RIA Services: 概述, 通过 DomainDataSource 实现数据的添加、查询、更新和删除操作
- JDBC之关于数据库操作回滚研究(JDBC之四)
- MySQL数据记录基本操作——添加数据、更新数据和删除数据
- 10W级数据更新操作__生产消费者模式
- JDBC实现数据库的几种基本操作(查询,分页查询,根据关键字进行查询以及插入数据)
- 关于使用游标更新数据和Case语句进行更新的实现过程