没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
package com.xss.excel;
import java.util.*;
//读取excel表中的数据到数据库中
public class ExcelToDB {
public static void main(String [] args){
//得到表格中所有的数据
List<LocationEntity> listExcel = Service.getAllByExcel("");
DBHelper db = new DBHelper();
for (LocationEntity location: listExcel){
int id = location.getId();
//如果数据库中不存在该id
if (!Service.isExist(id)){
//不存在就添加
String sql = "insert into location(id, lat, lng) value(?, ?, ?)";
String[] str = new String[]{id + "", location.getLat()+"", location.getLng()+""};
db.add(sql, str);
}else {
//存在该条数据就更新数据
String sql = "update location set lat=?, lng=? where id=?";
String[] str = new String[]{location.getLat()+"", location.getLng()+"", id+""};
db.add(sql, str);
}
}
import java.util.*;
//读取excel表中的数据到数据库中
public class ExcelToDB {
public static void main(String [] args){
//得到表格中所有的数据
List<LocationEntity> listExcel = Service.getAllByExcel("");
DBHelper db = new DBHelper();
for (LocationEntity location: listExcel){
int id = location.getId();
//如果数据库中不存在该id
if (!Service.isExist(id)){
//不存在就添加
String sql = "insert into location(id, lat, lng) value(?, ?, ?)";
String[] str = new String[]{id + "", location.getLat()+"", location.getLng()+""};
db.add(sql, str);
}else {
//存在该条数据就更新数据
String sql = "update location set lat=?, lng=? where id=?";
String[] str = new String[]{location.getLat()+"", location.getLng()+"", id+""};
db.add(sql, str);
}
}
资源评论
coralline_xss
- 粉丝: 14
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功