Import personal geographic database (mdb Format) based on AE to enterprise-level database (SDE database) (C #) [original]

Source: Internet
Author: User

The personal Geographic Database Based on AE (mdb Format) is imported into the enterprise-level database (SDE database, using the Oracle database) (C #).

A personal geographic database has datasets. After being imported to an enterprise-level database, there are no datasets and only element classes.

Private void btnpgd2egd_click (Object sender, eventargs E)
String pworkspacename = strname;
String sdeuser = psdewsp. connectionproperties. getproperty ("user"). tostring ();
Iworkspacefactory pmdbwspf = new accessworkspacefactoryclass ();
Pmdbwsp = pmdbwspf. openfromfile (pworkspacename, 0 );
Cursor = cursors. waitcursor;
If (psdewsp! = NULL)
// Progressbar. Visible = true;
Datavonverter (ref pmdbwsp, ref psdewsp, sdeuser); // data import
Progressbar. Visible = false;

Cursor = cursors. default;
Catch (exception ex)
MessageBox. Show (ex. tostring ());

MessageBox. Show ("MDB data is successfully uploaded to the SDE database! "," Data Import ", messageboxbuttons. OK, messageboxicon. information );
This. Close ();


Public void datavonverter (ref iworkspace fromworkspace, ref iworkspace toworkspace, string sdeuser)
{< br> If (sdeuser = ") return;
ifeatureworkspace release;
ifeatureworkspace pinfeatureworkspace;
ifeatureclass pfeatureclass;
iworkspace2 pworkspace2;
ienumdataset penumdataset;
idataset poutdataset;

Ifeaturedataset poutfeaturedataset;
Ienumfeatureclass penumfeatureclass;
Ifeatureclasscontainer pfeatureclasscontainer;

Poutfeatureworkspace = (ifeatureworkspace) toworkspace;
Pinfeatureworkspace = (ifeatureworkspace) fromworkspace;
Pworkspace2 = (iworkspace2) toworkspace;

Penumdataset = (ienumdataset) fromworkspace. get_datasets (esridatasettype. esridtfeaturedataset); // obtain all datasets on the MDB end
Poutdataset = (idataset) penumdataset. Next ();

While (poutdataset! = NULL) // traverse the dataset
Poutfeaturedataset = (ifeaturedataset) poutdataset;
If (poutfeaturedataset! = NULL)
Pfeatureclasscontainer = (ifeatureclasscontainer) poutfeaturedataset;
Penumfeatureclass = (ienumfeatureclass) pfeatureclasscontainer. classes;
Pfeatureclass = (ifeatureclass) penumfeatureclass. Next ();
While (pfeatureclass! = NULL) // traverse the data layer ifeatureclass in each dataset
If (! Pfeatureclass. aliasname. Contains ("unclassfied "))
If (pworkspace2.get _ nameexists (esridatasettype. esridtfeatureclass, sdeuser + "." + pfeatureclass. aliasname ))
Poutfeatureclass = poutfeatureworkspace. openfeatureclass (sdeuser + "." + pfeatureclass. aliasname );
Fc2fc (ref pfeatureclass, ref poutfeatureclass );
Fc2fc (ref pfeatureclass, ref toworkspace );
Pfeatureclass = (ifeatureclass) penumfeatureclass. Next ();
Poutdataset = (idataset) penumdataset. Next ();

Itable pintable;
Pintable = pinfeatureworkspace. OpenTable ("aindexinfo ");
// If the SDE database already has the aindexinfo table, append the new record
If (pworkspace2.get _ nameexists (esridatasettype. esridttable, sdeuser + "." + "aindexinfo "))
Itable pouttable = poutfeatureworkspace. OpenTable ("aindexinfo ");
Fusedindextable (ref pintable, ref pouttable );
Else // If the SDE database does not have the aindexinfo table, the aindexinfo table, which is the same as the source database, will be regenerated.
Fusedindextable (ref pintable, ref toworkspace );

Reprinted, please indicate the source: and Author: GIS cloud crane

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.