string connectString = "User ID=xxxxx;Password=xxxx;Data Source=192.168.14.168/local;";
OracleFeatureLayer oFeatureLayer = new OracleFeatureLayer(connectString, "LAYOUTDIAGRAM", "OBJECTID", DatabaseConnectionMode.AutoClose);
oFeatureLayer.Open();
oFeatureLayer.EditTools.BeginTransaction();
Feature pFeature = new Feature();
pFeature = oFeatureLayer.FeatureSource.GetFeatureById("121", ReturningColumnsType.AllColumns); ;
pFeature.ColumnValues["REMARK"] = "XIXI";
oFeatureLayer.EditTools.Update(pFeature);
TransactionResult tr = oFeatureLayer.EditTools.CommitTransaction();
oFeatureLayer.Close();
tr.TransactionResultStatus Success
tr.TotalFailureCount 1
tr.TotalSuccessCount 0
error:
System.NullReferenceException:Object reference not set to an instance of an object
How to make use of OracleFeatureLayer add and modify feature?
Hi Guo,
Would you please check if the pFeature can be gotten from Oracle?
Modify
Feature pFeature = new Feature();
to
Feature pFeature = null;
Also, can you get the layer’s boundingBox or all the features from the layer? with the codes:
RectangleShape boundingBox = oFeatureLayer.GetBoundingBox();
Collection<Feature> features = oFeatureLayer.FeatureSource.GetAllFeatures(ReturningColumnsType.AllColumns);
Regards,
Johnny
Hi Johnny,
Access to the Feature.
After modify feature ‘REMARK’ properties, perform the update
Error message is:
Tr. TransactionResultStatus Success
Tr. TotalFailureCount 1
Tr. TotalSuccessCount 0
Guo,
Please help me to make sure:
1. The OracleFeatureLayer can connect to the Oracle.
2. We can get the boundingbox or any features from the OracleFeatureLayer without any exceptions.
3. would you please provide the detailed results from my last reply?
Or a concrete sample which includes the oracle data is highly appreciate.
Johnny
Hi, Johnny
1.yes
2.yes
3.NO
I used test data in the attachment!
Hi Guo,
We didn’t see the attachment. Could you please attach it again?
Thanks,
Johnny