Some javascript/style in this post has been disabled (
why?)
Hi All,
I am trying to access the data from one table of oracle
spatial using FDO.
The table which I am trying to access contains a column
which is the “FOREIGN KEY” to
another table and both column names are same.
When I am trying to execute the select command it is
throwing error like ("column ambiguously defined"). I tried to
findout the cause for this on the web it says that “when a join query contains two columns with same the name this
error will raise”. But in my code I am accessing only
one table there are no joins in this….
I am posting my code along with this mail… please help
me to solve this issue,

Thank you,
Shaik Esu.
using System;
using System.Collections.Generic;
using System.Text;
using OSGeo.FDO;
using OSGeo.FDO.Geometry;
using OSGeo.FDO.ClientServices;
using OSGeo.FDO.Connections;
using OSGeo.FDO.Commands;
using OSGeo.FDO.Commands.DataStore;
using OSGeo.FDO.Commands.Feature;
using OSGeo.FDO.Commands.Schema;
using OSGeo.FDO.Expression;
using OSGeo.FDO.Schema;
using OSGeo.FDO.Spatial;
using OSGeo.FDO.Common;
using System.Windows.Forms;
namespace WindowsApplication2
{
class FDOOracleSpatialClass
{
private static IProviderRegistry FDORegistry = FeatureAccessManager.GetProviderRegistry();
private IConnectionManager FDOManager = FeatureAccessManager.GetConnectionManager();
ProviderCollection pcol = FDORegistry.GetProviders();
private IConnection FDOConnection = FeatureAccessManager.GetConnectionManager().CreateConnection("Autodesk.Oracle.3.3");
public ConnectionState Constate;
string featureclsname;
public FDOOracleSpatialClass(string username, string password, string servicename, string featureclassname)
{
FDOConnection.ConnectionInfo.ConnectionProperties.SetProperty("USERNAME", username);
FDOConnection.ConnectionInfo.ConnectionProperties.SetProperty("PASSWORD", password);
FDOConnection.ConnectionInfo.ConnectionProperties.SetProperty("SERVICE", servicename);
FDOConnection.ConnectionInfo.ConnectionProperties.SetProperty("DATASTORE", username);
featureclsname = featureclassname;
Constate = FDOConnection.Open();
}
public ConnectionState CheckConnected
{
get
{
return Constate;
}
}
public GeometryCollection SelectAllQuery(string value)
{
GeometryCollection Geo_Collection = new GeometryCollection();
try
{
ISelect sel = (ISelect)FDOConnection.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandType_Select);
sel.SetFeatureClassName(featureclsname);
IFeatureReader FDOReader = sel.Execute();
FgfGeometryFactory gFac = new FgfGeometryFactory();
while (FDOReader.ReadNext())
{
// Byte[] Tmppts = FDOReader.GetGeometry("GEOM");
Byte[] Tmppts = FDOReader.GetGeometry("GEOMFOOTPRINT");
Geo_Collection.Add(gFac.CreateGeometryFromFgf(Tmppts));
}
}
catch(OSGeo.FDO.Common.Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
return Geo_Collection;
}
public IPolygon GetExtents(string featureclassname)
{
IPolygon retpolygon;
ISelectAggregates pselagree = (ISelectAggregates)FDOConnection.CreateCommand(CommandType.CommandType_SelectAggregates);
pselagree.SetFeatureClassName(featureclassname);
IdentifierCollection props = pselagree.PropertyNames;
Expression exp = Expression.Parse("SpatialExtents(GEOM)");
ComputedIdentifier se = new ComputedIdentifier("Extents", exp);
props.Add(se);
IDataReader FDOReader = pselagree.Execute();
FgfGeometryFactory GeoFac = new FgfGeometryFactory();
FDOReader.ReadNext();
Byte[] Tmppts = FDOReader.GetGeometry("Extents");
IGeometry Geo = GeoFac.CreateGeometryFromFgf(Tmppts);
retpolygon = (IPolygon)Geo;
return retpolygon;
}
public void UpdateQuery()
{
throw new System.NotImplementedException();
}
public void DeleteQuery()
{
throw new System.NotImplementedException();
}
public void Dispose()
{
Close();
FDORegistry.Dispose();
FDOManager.Dispose();
FDOConnection.Dispose();
}
private void Close()
{
FDOConnection.Close();
}
}
}
_______________________________________________
fdo-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fdo-users