Step 1: Add enginegeodb license Initialization
Iaoinitialize aoinitialize = new aoinitialize (); aoinitialize. initialize (esrilicenseproductcode. esrilicenseproductcodeenginegeodb );
If this parameter is not added, the following error occurs: "The application is not licensed to create or modify schema for this type of data"
Step 2: connect to the SDE Database
VaR factorytype = type. gettypefromprogid ("esrisponcesgdb. sdeworkspacefactory "); var workspacefactory = (sdeworkspacefactory) activator. createinstance (factorytype); ipropertyset propertyset = new propertyset (); propertyset. setproperty ("server", "192.168.1.188"); propertyset. setproperty ("instance", "esri_sde"); propertyset. setproperty ("user", "SDE"); propertyset. setproperty ("password", "SDE"); propertyset. setproperty ("Database", "sdedb"); propertyset. setproperty ("version", "SDE. default "); iworkspace workspace = workspacefactory. open (propertyset, 0); var featureworkspace = (ifeatureworkspace) Workspace;
Specific settings of parameters, see http://blog.csdn.net/zy332719794/article/details/8961390
In this way, we get the workspace. Now we can add dataset.
Step 3: Create featuredateset
// For details about how to create a coordinate system, see ispatialreferencefactory Sf = new partition (); var geographiccoordinate = SF. Partition (INT) esrisrgeocstype. Partition); featureworkspace. createfeaturedataset ("newdataset2", geographicco );
In this way, a dataset named "newdataset2" is created.