Hello James, Thank you for your input. I saw your response over on the page with your download, and figured out what to do... Works great now... One would figure that ESRI would have something along these lines, but I couldn't find it...Thanks again,Kevin Orcutt
Public Function ConvertToADONETDataTableFromLayer(ByVal inLayer As IFeatureLayer) As DataTable Try Dim tmpDT As New DataTable("tmpDT") Dim column As DataColumn Dim pTable As ITable = inLayer.FeatureClass Dim pFields As IFields = pTable.Fields Dim pCur As ICursor = pTable.Search(Nothing, False) For c = 0 To pCur.Fields.FieldCount - 1 column = New DataColumn() column.ColumnName = (pFields.Field(c).Name) If pFields.Field(c).Type = esriFieldType.esriFieldTypeString Then column.DataType = System.Type.GetType("System.String") ElseIf pFields.Field(c).Type = esriFieldType.esriFieldTypeInteger Then column.DataType = System.Type.GetType("System.Int32") ElseIf pFields.Field(c).Type = esriFieldType.esriFieldTypeDouble Then column.DataType = System.Type.GetType("System.Double") ElseIf pFields.Field(c).Type = esriFieldType.esriFieldTypeDate Then column.DataType = System.Type.GetType("System.DateTime") ElseIf pFields.Field(c).Type = esriFieldType.esriFieldTypeSingle Then column.DataType = System.Type.GetType("System.Single") ElseIf pFields.Field(c).Type = esriFieldType.esriFieldTypeBlob Then column.DataType = System.Type.GetType("System.Byte") End If column.ReadOnly = False tmpDT.Columns.Add(column) Next Dim pRow As IRow = pCur.NextRow Dim newRow As DataRow Do Until pRow Is Nothing newRow = tmpDT.NewRow() newRow.BeginEdit() For cols = 0 To pCur.Fields.FieldCount - 1 newRow(cols) = pRow.Value(pRow.Fields.FindField(pFields.Field(cols).Name)) Next newRow.EndEdit() tmpDT.Rows.Add(newRow) tmpDT.AcceptChanges() pRow = pCur.NextRow Loop Return tmpDT Catch ex As Exception MsgBox(ex.ToString) Return Nothing End Try End Function
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.