[fdo-internals] SQL Server, connection and schema
mdelsinne
mdelsinne at gmail.com
Tue Nov 22 12:10:13 EST 2011
*Hello,
I try to create spatial data in SQL Server 2008, I use the provider:
OSGeo.SQLServerSpatial.3.6*
*I manage to connect to my database, it works:*
connProperties.SetProperty ("Service", "host");
connProperties.SetProperty ("Username", "user");
connProperties.SetProperty ("Password", "****");
connProperties.SetProperty ("DataStore", "bdd");
connState = conn.Open ();
*I created my feature class + properties:*
FeatureClass aFeatureClass FeatureClass = new ("CLASSTEST", "");
// Add a id property
DataPropertyDefinition idProp = new DataPropertyDefinition("ID",
"");
idProp.DataType = DataType.DataType_Int64;
idProp.IsAutoGenerated = true;
idProp.Nullable = false;
aFeatureClass.Properties.Add(idProp);
aFeatureClass.IdentityProperties.Add(idProp);
idProp.Dispose();
// Add a key property
DataPropertyDefinition keyProp = new
DataPropertyDefinition("KEY", "");
keyProp.DataType = DataType.DataType_String;
keyProp.Length = 255;
aFeatureClass.Properties.Add(keyProp);
keyProp.Dispose();
// Add a name property
DataPropertyDefinition nameProp = new
DataPropertyDefinition("NAME", "");
nameProp.DataType = DataType.DataType_String;
nameProp.Length = 255;
aFeatureClass.Properties.Add(nameProp);
nameProp.Dispose();
// Add a url property
DataPropertyDefinition urlProp = new
DataPropertyDefinition("URL", "");
urlProp.DataType = DataType.DataType_String;
urlProp.Length = 255;
aFeatureClass.Properties.Add(urlProp);
urlProp.Dispose();
// Add a geometry property
GeometricPropertyDefinition geomProp = new
GeometricPropertyDefinition("Geom", "");
geomProp.GeometryTypes =
(int)GeometryType.GeometryType_MultiGeometry;
aFeatureClass.Properties.Add(geomProp);
aFeatureClass.GeometryProperty = geomProp;
geomProp.Dispose();
*An existing schema (dbo), confirmed by DescribeSchemaMapping.*
FeatureSchema aFeatureSchema = new FeatureSchema("dbo", "");
aFeatureSchema.Classes.Add(aFeatureClass);
IApplySchema applySchema = (IApplySchema) connect.CreateCommand
(OSGeo.FDO.Commands.CommandType.CommandType_ApplySchema);
applySchema.FeatureSchema FeatureSchema = aFeatureSchema;
applySchema.Execute ();
*Everything seems set up correctly, yet it not work:*
Schema dbo has errors;cannot apply it
*But impossible to apply the schema:*
Thank's !!!
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/SQL-Server-connection-and-schema-tp7021142p7021142.html
Sent from the FDO Internals mailing list archive at Nabble.com.
More information about the fdo-internals
mailing list