04 dbutils添加删除更新案例

版权声明:版权声明:本文为博主原创文章,未经博主允许不得转载,博客地址:http://blog.csdn.net/xpala https://blog.csdn.net/xpala/article/details/89202139
@Test
	public void test2() throws SQLException {
		QueryRunner qr=new QueryRunner(C3P0Utils.getDataSource());
		String sql="insert into account(name,money) values(?,?)";
		int r=qr.update(sql,"ddd",1000.09);
		System.out.println(r);
	}
	@Test
	public void test3() throws SQLException {
		QueryRunner qr=new QueryRunner(C3P0Utils.getDataSource());
		String sql="delete from account where id=?";
		int r = qr.update(sql,4);
		System.out.println(r);
	}
	@Test
	public void test4() throws SQLException{
		QueryRunner qr=new QueryRunner(C3P0Utils.getDataSource());
		String sql="update account set name=?,money=? where id=?";
		int r=qr.update(sql,"test",1230,3);
		System.out.println(r);
	}

猜你喜欢

转载自blog.csdn.net/xpala/article/details/89202139
04