tianyufeixiang9 2014-02-25 01:26 采纳率: 0%
浏览 1047

arcgis插入数据没报错 单表中无数据 arcgis高手帮忙

try{
// conn.startTransaction();//本例中只有一个点,有没有事务处理无所谓。
String[] cols = new String[3];//这里定义,一定要注意对于objectid是由系统自动维护,如果这个定义中包含了objectid的信息,那么后面无论怎么给值,系统都会出现-113或-114这样的异常。
//String[] cols = new String[1];
cols[0] = new String("人员");
//cols[0] = new String("ss");
cols[1] = new String("罚金");
cols[2] = insertLayer.getSpatialColumn();
//cols[0] = insertLayer.getSpatialColumn();
insert = new SeInsert(conn);
insert.setState(stateOne.getId(), new SeObjectId(SeState.SE_NULL_STATE_ID), SeState.SE_STATE_DIFF_NOCHECK);

             insert.intoTable(insertLayer.getName(),cols);
             insert.setWriteMode(true);
             SeCoordinateReference coordref =(SeCoordinateReference)insertLayer.getCoordRef();
             SeShape shape = new SeShape(coordref);



             int numParts = 1;
             int[] partOffsets = new int[numParts];
             partOffsets[0] = 0;
             int numPts = 5;
             SDEPoint[] ptArray = new SDEPoint[numPts]; 
             // Points of a sub-part should be ordered in the counter-clockwise direction.
             ptArray[0] = new SDEPoint(116,36.5);
             ptArray[1] = new SDEPoint(116,37);
             ptArray[2] = new SDEPoint(116,37.5);
             ptArray[3] = new SDEPoint(117,35);
             // The last point should be the same as the first. This closes the polygon shape.
             ptArray[4] = new SDEPoint(116,36.5);  
             SeShape shape2 = new SeShape(coordref);
             shape2.generatePolygon(numPts, numParts, partOffsets, ptArray); 

            /* int numPts = 1;
             SDEPoint[] ptArray = new SDEPoint[numPts];
             ptArray[0] = new SDEPoint(117,36);
             shape.generatePoint(numPts, ptArray);*/

             SeRow row = insert.getRowToSet();
             row.setNString(0, new String("n"));
             row.setInteger(1, new Integer(33));
             row.setShape(2,shape2);
          //   row.setShape(0,shape);
             insert.execute(); 

             //conn.commitTransaction();
             insert.close();

}catch(Exception ex){
ex.printStackTrace();
try {
conn.rollbackTransaction();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ex.printStackTrace();
}finally{
if(insert!=null){
try {
// insert.setWriteMode(false);
insert.close();
} catch (SeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if(conn!=null){
try {
conn.close();
} catch (SeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

         }

上边程序正常执行完,没报错,但是登陆数据看看表里 没有数据插入

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 求数据集和代码#有偿答复
    • ¥15 关于下拉菜单选项关联的问题
    • ¥15 如何修改pca中的feature函数
    • ¥20 java-OJ-健康体检
    • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
    • ¥15 使用phpstudy在云服务器上搭建个人网站
    • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
    • ¥15 vue3+express部署到nginx
    • ¥20 搭建pt1000三线制高精度测温电路
    • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况