进度日报(三)

今天将行政区划和行政编码获取到导入数据库。

for(int i=0;i<list1().size();i++)
//		{
//			System.out.println(list1().get(i).getCg()+"+++++++++++++"+list1().get(i).getLxdwdz());
//			if(list1().get(i).getLxdwdz()!=null)
//			try {
//	            // 加载数据库驱动,注册到驱动管理器
//	            Class.forName("com.mysql.jdbc.Driver");
//	            // 数据库连接字符串
//	            String url = "jdbc:mysql://localhost:3306/demo?useUnicode=true&characterEncoding=utf-8";
//	            // 数据库用户名
//	            String username = "root";
//	            // 数据库密码
//	            String password = "893225523";
//	            // 创建Connection连接
//	            Connection conn = DriverManager.getConnection(url, username,
//	                    password);
//	            // 添加图书信息的SQL语句
//	            String sql = "update final_test2 set 行政区县='"+addressResolution(getlocation1(list1().get(i).getLxdwdz()))+"' where 成果名称 ='"+list1().get(i).getCg()+"'";
//	            Statement statement = conn.createStatement();          
//	            statement.executeUpdate(sql);
//	            conn.close();
//	            
//	}catch (Exception e) {
//	    e.printStackTrace();
//	}
		//}//这是update行政区县(已完成)
		
      //System.out.println(addressResolution(getlocation1("天津")));
//		for(int j=0;j<list2().size();j++)
//		{
//			try {
//	            // 加载数据库驱动,注册到驱动管理器
//	            Class.forName("com.mysql.jdbc.Driver");
//	            // 数据库连接字符串
//	            String url = "jdbc:mysql://localhost:3306/demo?useUnicode=true&characterEncoding=utf-8";
//	            // 数据库用户名
//	            String username = "root";
//	            // 数据库密码
//	            String password = "893225523";
//	            // 创建Connection连接
//	            Connection conn = DriverManager.getConnection(url, username,
//	                    password);
//	            // 添加图书信息的SQL语句
//	            String sql = "update final_test2 set 行政编码='"+code(list2().get(j).getXzqx())+"' where 成果名称 ='"+list1().get(j).getCg()+"'";
//	            Statement statement = conn.createStatement();          
//	            statement.executeUpdate(sql);
//	            conn.close();
//	            
//	}catch (Exception e) {
//	    e.printStackTrace();
//	}
//		}//行政编码(已完成)

  

 

posted @ 2020-03-14 20:51  Double晨  阅读(220)  评论(0编辑  收藏  举报