DButils 执行数据库更新操作,dbutils数据库,QueryRunner
分享于 点击 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
用户点评