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 delta降尺度方法,未来数据怎么降尺度
    • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
    • ¥15 再不同版本的系统上,TCP传输速度不一致
    • ¥15 高德地图点聚合中Marker的位置无法实时更新
    • ¥15 DIFY API Endpoint 问题。
    • ¥20 sub地址DHCP问题
    • ¥15 delta降尺度计算的一些细节,有偿
    • ¥15 Arduino红外遥控代码有问题
    • ¥15 数值计算离散正交多项式
    • ¥30 数值计算均差系数编程