欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > 文章正文

DButils 执行数据库更新操作,dbutils数据库,QueryRunner

来源: javaer 分享于  点击 4775 次 点评:258

DButils 执行数据库更新操作,dbutils数据库,QueryRunner


QueryRunner run = new QueryRunner( dataSource );try{    // Execute the SQL update statement and return the number of    // inserts that were made    int inserts = run.update( "INSERT INTO Person (name,height) VALUES (?,?)",                              "John Doe", 1.82 );    // The line before uses varargs and autoboxing to simplify the code    // Now it's time to rise to the occation...    int updates = run.update( "UPDATE Person SET height=? WHERE name=?",                              2.05, "John Doe" );    // So does the line above}catch(SQLException sqle) {    // Handle it}//该片段来自于http://byrx.net
相关栏目:

用户点评