Select to view content in your preferred language

VB or C# to read a FC and write in a table

729
5
03-29-2019 08:00 AM
JoseSanchez
Regular Contributor

Hello everyone,

I am looking for a sample code in VB or C# to read a versioned feature class in a SDE SQL database table and write in a table in another  SQL database.

Thanks

0 Kudos
5 Replies
JoshuaBixby
MVP Esteemed Contributor

Using what library/SDK?

0 Kudos
JoseSanchez
Regular Contributor

Yes using ArcObjects SDK. I am thinking about a console application.

We tried reading directly the FC tabular table in SDE, but when the FC is not compressed, the table in Default does not have all the Delta records. To avoid that it is better to read the FC and save the data in a local table in another SQL server database.

0 Kudos
leomonterol
Esri Contributor

Actually, you can query the data using SQL (you must query the Feature Class' versioned view). Using this method you can even query a specific Geodatabase version.

See links below:

Oracle

http://desktop.arcgis.com/en/arcmap/latest/manage-data/using-sql-with-gdbs/edit-versioned-data-using...

SQL Server

http://desktop.arcgis.com/en/arcmap/latest/manage-data/using-sql-with-gdbs/edit-versioned-data-using...

JoseSanchez
Regular Contributor


Thank you very much Leonardo,

I knew about versioned views to point to default  version, but I a discovering with your link all the options to create and update specific versions.

It is a very helpful link.

I have an additional question!  We have a  regular ASP.Net Web application that uses the attribute data from one of the versioned feature classes, the SDE Projects FC.  

What approach do you recommend for the web application to query this FC data:

  • point to SDE using a versioned view (This is the approach I prefer)
  • running a script to copy the FC from SDE to a regular table in SQL Server 

Thanks

Jose

0 Kudos
leomonterol
Esri Contributor

Hi Jose

Since you're already working with a Geodatabase, I'd probably suggest the first approach. This way every change made in the Feature class will be seen in the view.

Also, with the second approach you will need to run the script every now and then to keep the table updated.

0 Kudos