当前位置: 首页>>代码示例>>C#>>正文


C# ITable.CreateRow方法代码示例

本文整理汇总了C#中ITable.CreateRow方法的典型用法代码示例。如果您正苦于以下问题:C# ITable.CreateRow方法的具体用法?C# ITable.CreateRow怎么用?C# ITable.CreateRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITable的用法示例。


在下文中一共展示了ITable.CreateRow方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: registrarUsuario

        public void registrarUsuario(ITable pTable, int ID)
        {
            try
            {
                IRow pRow = pTable.CreateRow();
                for (int i = 0; i < pRow.Fields.FieldCount; i++)
                {
                    if (pRow.Fields.get_Field(i).Name == "ID_IMGN")
                    {
                        pRow.set_Value(i, ID);
                    }
                    else if (pRow.Fields.get_Field(i).Name == "DES_USUARIO")
                    {
                        pRow.set_Value(i, Environment.UserName);

                    }
                    else if (pRow.Fields.get_Field(i).Name == "DES_FECHA")
                    {
                        DateTime fecha = DateTime.Today;
                        pRow.set_Value(i, fecha);
                    }
                    pRow.Store();

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error actualizando Base de Datos  "  + ex.Message);
            }
            

        }
开发者ID:fgonzalezf,项目名称:Teleobservacion,代码行数:32,代码来源:Table_To_DataTable.cs

示例2: StatisticPointCount

        /// <summary>
        /// 第一个参数为面数据,第二个参数为点数据,第三个为输出的表
        /// </summary>
        /// <param name="_pPolygonFClass"></param>
        /// <param name="_pPointFClass"></param>
        /// <param name="_pTable"></param>
        public void StatisticPointCount(IFeatureClass _pPolygonFClass, IFeatureClass _pPointFClass, ITable _pTable)
        {
            IFeatureCursor pPolyCursor = _pPolygonFClass.Search(null, false);

            IFeature pPolyFeature = pPolyCursor.NextFeature();

            while (pPolyFeature != null)
            {
                IGeometry pPolGeo = pPolyFeature.Shape;

                int Count = 0;

                ISpatialFilter spatialFilter = new SpatialFilterClass();

                spatialFilter.Geometry = pPolGeo;

                spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelContains;

                spatialFilter.WhereClause = "矿种=" + "'煤'";

                IFeatureCursor pPointCur = _pPointFClass.Search(spatialFilter, false);

                if (pPointCur != null)
                {
                    IFeature pPointFeature = pPointCur.NextFeature();

                    while (pPointFeature != null)
                    {
                        pPointFeature = pPointCur.NextFeature();
                        Count++;
                    }

                }

                if (Count != 0)
                {

                    IRow pRow = _pTable.CreateRow();
                    pRow.set_Value(1, pPolyFeature.get_Value(0));
                    pRow.set_Value(2, Count);
                    pRow.Store();
                }
                pPolyFeature = pPolyCursor.NextFeature();

            }
        }
开发者ID:esrichina,项目名称:Engine10DevApplication,代码行数:52,代码来源:Search.cs

示例3: InsertNewRow

        public bool InsertNewRow(ITable table,IWorkspaceEdit workspace)
        {
            using (ComReleaser comReleaser = new ComReleaser())
            {
                try
                {
                    multiWspEdit.StartMultiuserEditing(esriMultiuserEditSessionMode.esriMESMVersioned);
                    workspace.StartEditOperation();
                    _currentRow = table.CreateRow();
                    _currentRow.Store();
                    workspace.StopEditOperation();
                    workspace.StopEditing(true);
                    return true;
                }
                catch {
                    workspace.StopEditOperation();
                    workspace.StopEditing(false);
                    return false; }

            }
        }
开发者ID:truonghinh,项目名称:TnX,代码行数:21,代码来源:SDETable.cs

示例4: CopyTable

 public static void CopyTable(ITable pSrcTable, ITable pDestTable)
 {
     Exception exception;
     try
     {
         if ((pSrcTable != null) && (pDestTable != null))
         {
             List<int> pSrcField = null;
             List<int> pDestField = null;
             CreateFieldMap(pSrcTable, pDestTable, out pSrcField, out pDestField);
             ICursor o = pSrcTable.Search(null, true);
             int num = pSrcTable.RowCount(null);
             if (num > 0)
             {
                 int num2 = (num / 10) + 1;
                 IWorkspaceEdit edit = (pDestTable as IDataset).Workspace as IWorkspaceEdit;
                 edit.StartEditing(false);
                 edit.StartEditOperation();
                 IRow pSrcFea = o.NextRow();
                 int num3 = 1;
                 while (pSrcFea != null)
                 {
                     try
                     {
                         if ((num2 >= 0x3e8) && ((num3++ % num2) == 0))
                         {
                             edit.StopEditOperation();
                             edit.StopEditing(true);
                             edit.StartEditing(false);
                             edit.StartEditOperation();
                         }
                         IRow pDestFea = pDestTable.CreateRow();
                         CopyRow(pSrcFea, pDestFea, pSrcField, pDestField);
                         if ((pSrcFea is IFeature) && (pDestFea is IFeature))
                         {
                             (pDestFea as IFeature).Shape = (pSrcFea as IFeature).ShapeCopy;
                         }
                         pDestFea.Store();
                     }
                     catch (Exception exception1)
                     {
                         exception = exception1;
                     }
                     pSrcFea = o.NextRow();
                     edit.StopEditOperation();
                     edit.StopEditing(true);
                 }
                 Marshal.ReleaseComObject(o);
             }
         }
     }
     catch (Exception exception2)
     {
         exception = exception2;
     }
 }
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:56,代码来源:FeatureHelper.cs

示例5: createTable

        private void createTable()
        {
            string tblName = "catTbl.dbf";
            IWorkspace wks = geoUtil.OpenWorkSpace(rsUtil.TempMosaicDir);
            IFields flds = new FieldsClass();
            IFieldsEdit fldsE = (IFieldsEdit)flds;
            IField fld = new FieldClass();
            IFieldEdit fldE = (IFieldEdit)fld;
            fldE.Name_2 = "catIndex";
            fldE.Type_2 = esriFieldType.esriFieldTypeSmallInteger;
            fldsE.AddField(fldE);

            IField fld2 = new FieldClass();
            IFieldEdit fldE2 = (IFieldEdit)fld2;
            fldE2.Name_2 = "XMIN";
            fldE2.Type_2 = esriFieldType.esriFieldTypeDouble;
            fldsE.AddField(fldE2);

            IField fld3 = new FieldClass();
            IFieldEdit fldE3 = (IFieldEdit)fld3;
            fldE3.Name_2 = "XMAX";
            fldE3.Type_2 = esriFieldType.esriFieldTypeDouble;
            fldsE.AddField(fldE3);

            IField fld4 = new FieldClass();
            IFieldEdit fldE4 = (IFieldEdit)fld4;
            fldE4.Name_2 = "YMIN";
            fldE4.Type_2 = esriFieldType.esriFieldTypeDouble;
            fldsE.AddField(fldE4);

            IField fld5 = new FieldClass();
            IFieldEdit fldE5 = (IFieldEdit)fld5;
            fldE5.Name_2 = "YMAX";
            fldE5.Type_2 = esriFieldType.esriFieldTypeDouble;
            fldsE.AddField(fldE5);

            tbl = geoUtil.createTable(wks,tblName,flds);
            int catInd = tbl.FindField("catIndex");
            int xMinInd = tbl.FindField("XMIN");
            int xMaxInd = tbl.FindField("XMAX");
            int yMinInd = tbl.FindField("YMIN");
            int yMaxInd = tbl.FindField("YMAX");
            int cnt = 0;
            foreach (IRaster rs in inrs)
            {
                IRow rw = tbl.CreateRow();
                rw.set_Value(catInd, cnt);
                IEnvelope ext = ((IRasterProps)rs).Extent;
                rw.set_Value(xMinInd, ext.XMin);
                rw.set_Value(xMaxInd, ext.XMax);
                rw.set_Value(yMinInd, ext.YMin);
                rw.set_Value(yMaxInd, ext.YMax);
                rw.Store();
                cnt++;
            }
        }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:56,代码来源:mergeFunctionArguments.cs

示例6: appendSamples

        private void appendSamples(ITable sampledTable, ITable samplesToDrawFromTable, Dictionary<string, object[]> sampledBinPropDic,Statistics.dataPrepCompareSamples dpComp)
        {
            Dictionary<string,object[]> bigSampleDic = calcBinValues(dpComp,samplesToDrawFromTable);
            Dictionary<string, double[]> ratioDic = new Dictionary<string, double[]>();
            bool check = false;
            foreach (KeyValuePair<string, object[]> kvp in sampledBinPropDic)
            {
                string ky = kvp.Key;

                int[] cntArr = (int[])kvp.Value[1];
                int totalCnt = cntArr.Sum();
                //double[] ratioArr = (double[])kvp.Value[0];
                int[] cntArr2 = (int[])bigSampleDic[ky][1];
                double[] ratioArr2 = dpComp.ClusterProportions[ky];//.binPropDic1[ky][0];// (double[])bigSampleDic[ky][0];
                double[] nrArr = new double[ratioArr2.Length];
                for (int i = 0; i < cntArr.Length; i++)
                {
                    double nr = 0;
                    double r = ratioArr2[i];
                    int tCntS = cntArr[i];
                    int sN = (int)((totalCnt*r) - tCntS);
                    if (sN > 0)
                    {
                        check = true;
                        nr = System.Convert.ToDouble(sN) / cntArr2[i];
                    }
                    nrArr[i] = nr;
                }
                ratioDic.Add(ky, nrArr);
            }
            if (!check) return;
            Random rd = new Random();
            string[] labels = dpComp.Labels;
            List<int> bFldsIndex = new List<int>();
            List<int> sFldsIndex = new List<int>();
            for (int i = 0; i < sampledTable.Fields.FieldCount; i++)
            {
                IField sfld = sampledTable.Fields.get_Field(i);
                string sfldName = sfld.Name;
                int bfldIndex = samplesToDrawFromTable.FindField(sfldName);
                if (bfldIndex > -1 && sfld.Editable)
                {
                    bFldsIndex.Add(bfldIndex);
                    sFldsIndex.Add(i);
                }
            }
            ICursor cur = samplesToDrawFromTable.Search(null, false);
            int cIndex = cur.FindField(dpComp.StrataField);
            int bIndex = cur.FindField("BIN");
            IRow rw = cur.NextRow();
            int sIndex = sampledTable.FindField("Sample");
            int wIndex = sampledTable.FindField("Weight");
            while (rw != null)
            {
                string clustStr = labels[0];
                if (cIndex > -1)
                {
                    clustStr = rw.get_Value(cIndex).ToString();
                }
                int b = System.Convert.ToInt32(rw.get_Value(bIndex));
                double rNum = rd.NextDouble();
                double r = ratioDic[clustStr][b];
                if (rNum <= r)
                {
                    IRow srw = sampledTable.CreateRow();
                    for (int i = 0; i < sFldsIndex.Count; i++)
                    {
                        try
                        {
                            srw.set_Value(sFldsIndex[i], rw.get_Value(bFldsIndex[i]));
                        }
                        catch
                        {

                        }
                    }
                    if (sIndex > -1) srw.set_Value(sIndex, 1);
                    if (wIndex > -1) srw.set_Value(wIndex, sampledBinPropDic[clustStr][2]);
                    srw.Store();
                }
                rw = cur.NextRow();
            }
            System.Runtime.InteropServices.Marshal.ReleaseComObject(cur);
        }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:84,代码来源:featureUtil.cs

示例7: createConnectionDb


//.........这里部分代码省略.........
                fldE = (IFieldEdit)fld;
                fldE.Name_2 = "FKID";
                fldE.Type_2 = esriFieldType.esriFieldTypeInteger;
                fldE.IsNullable_2 = true;
                fldE.Editable_2 = true;
                fldE.AliasName_2 = "FKID";
                tblFldsE.AddField(fldE);
                fld = new FieldClass();
                fldE = (IFieldEdit)fld;
                fldE.Name_2 = "SERVICE";
                fldE.Type_2 = esriFieldType.esriFieldTypeString;
                fldE.Length_2 = 50;
                fldE.IsNullable_2 = true;
                fldE.Editable_2 = true;
                fldE.AliasName_2 = "SERVICE";
                tblFldsE.AddField(fldE);
                fld = new FieldClass();
                fldE = (IFieldEdit)fld;
                fldE.Name_2 = "URL";
                fldE.Type_2 = esriFieldType.esriFieldTypeString;
                fldE.Length_2 = 1000;
                fldE.IsNullable_2 = true;
                fldE.Editable_2 = true;
                fldE.AliasName_2 = "URL";
                tblFldsE.AddField(fldE);
                fld = new FieldClass();
                fldE = (IFieldEdit)fld;
                fldE.Name_2 = "STYPE";
                fldE.Type_2 = esriFieldType.esriFieldTypeString;
                fldE.Length_2 = 20;
                fldE.IsNullable_2 = true;
                fldE.Editable_2 = true;
                fldE.AliasName_2 = "STYPE";
                tblFldsE.AddField(fldE);
                tblSrv = fWks.CreateTable("SERVICES", tblFldsE, uid, null, "");
                //Create Layer Table related to Services
                tblFlds = objectClassDescription.RequiredFields;
                tblFldsE = (IFieldsEdit)tblFlds;
                fld = new FieldClass();
                fldE = (IFieldEdit)fld;
                fldE.Name_2 = "FKID";
                fldE.Type_2 = esriFieldType.esriFieldTypeInteger;
                fldE.IsNullable_2 = true;
                fldE.Editable_2 = true;
                fldE.AliasName_2 = "FKID";
                tblFldsE.AddField(fldE);
                fld = new FieldClass();
                fldE = (IFieldEdit)fld;
                fldE.Name_2 = "LAYERS";
                fldE.Type_2 = esriFieldType.esriFieldTypeString;
                fldE.Length_2 = 50;
                fldE.IsNullable_2 = true;
                fldE.Editable_2 = true;
                fldE.AliasName_2 = "LAYERS";
                tblFldsE.AddField(fldE);
                fld = new FieldClass();
                fldE = (IFieldEdit)fld;
                fldE.Name_2 = "LAYERID";
                fldE.Type_2 = esriFieldType.esriFieldTypeInteger;
                fldE.IsNullable_2 = true;
                fldE.Editable_2 = true;
                fldE.AliasName_2 = "LAYERID";
                tblFldsE.AddField(fldE);
                fld = new FieldClass();
                fldE = (IFieldEdit)fld;
                fldE.Name_2 = "UPDATE";
                fldE.Type_2 = esriFieldType.esriFieldTypeString;
                fldE.Length_2 = 3;
                fldE.IsNullable_2 = true;
                fldE.DefaultValue_2 = "NO";
                fldE.Editable_2 = true;
                fldE.AliasName_2 = "UPDATE";
                tblFldsE.AddField(fldE);
                tblLyr = fWks.CreateTable("LAYERS", tblFldsE, uid, null, "");
                int conIndex = tblCon.FindField("CONNECTION");
                IWorkspaceEdit wksE = (IWorkspaceEdit)servWks;
                bool weStart = false;
                if (!wksE.IsBeingEdited())
                {
                    wksE.StartEditing(false);
                    weStart = true;
                }
                wksE.StartEditOperation();
                IRow row = tblCon.CreateRow();
                row.set_Value(conIndex, gisProdServer);
                row.Store();
                wksE.StopEditOperation();
                if (weStart)
                {
                    wksE.StopEditing(true);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            finally
            {
            }
        }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:101,代码来源:mapserviceutility.cs

示例8: StartEdit

        public void StartEdit(IWorkspace pWorkspace, ITable pTable)
        {
            IWorkspaceEdit pWorkspaceEdit = (IWorkspaceEdit)pWorkspace;
             //启动编辑会话
             pWorkspaceEdit.StartEditing(false);
             //启动编辑操作
             pWorkspaceEdit.StartEditOperation();

             IRow pRow = pTable.CreateRow();

             pRow.set_Value(2, "练习");
             pRow.Store();
             //结束编辑操作
             pWorkspaceEdit.StopEditOperation();
             //结束编辑会话
             pWorkspaceEdit.StopEditing(true);
        }
开发者ID:esrichina,项目名称:Engine10DevApplication,代码行数:17,代码来源:MainForm.cs


注:本文中的ITable.CreateRow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。