Public void addsdelayer (bool chksdelinkmodle)
{
// <
SPAN style = "color: #008000;"> define an attribute
<
;/Span> ipropertyset propset = new propertysetclass ();
If (chksdelinkmodle = true) // connect with SDE
{
// Set the database server name
Propset. setproperty ("server", "ZJ-PC ");
// Set the SDE port, which is specified during installation. The default value is "port: 5151"
Propset. setproperty ("instance", "port: 5151 ");
// SDE Username
Propset. setproperty ("user", "SDE ");
// Password
Propset. setproperty ("password", "SDE ");
/// Set the database name. Only the SQL Server INFORMIX database needs to be set
// Propset. setproperty ("Database", "SDE ");
// SDE version, which is the default version
Propset. setproperty ("version", "SDE. Default ");
}
Else // direct connection
{
// Set the database server name. If it is a local machine, you can use "SDE: sqlserver :."
Propset. setproperty ("instance", "orcl ");
// SDE Username
Propset. setproperty ("user", "SDE ");
// Password
Propset. setproperty ("password", "SDE ");
// Set the database name. Only the SQL Server INFORMIX database needs to be set // propset. setproperty ("Database", "SDE ");
// SDE version, which is the default version
Propset. setproperty ("version", "SDE. Default ");
}
Iworkspacefactory fact = new sdeworkspacefactoryclass ();
Ifeatureworkspace workspace = (ifeatureworkspace) Fact. Open (propset, 0 );
Ifeatureclass FCLS = workspace. openfeatureclass ("SDE. historytrackline ");
Ifeaturelayer fly = new featurelayerclass ();
Fly. featureclass = FCLS;
Ifeatureclass fcls1 = workspace. openfeatureclass ("SDE. Province ");
Ifeaturelayer fly1 = new featurelayerclass ();
Fly1.featureclass = fcls1;
M_mapcontrol.map.addlayer (fly1 );
M_mapcontrol.map.addlayer (FLY );
M_mapcontrol.activeview.refresh ();
}