Hello, I´m binding a gridview with a ShapeFileFeatureSource.ExecuteQuery, it works fine, but I want to get the feature.id of the objects. With mapinfo I can use some like this "Select Obj.id,field1,field2 from Map Where …" , with mapsuite is possible something like this?
This is my code:
string strQuery = "Select * From " + strNombreLayer ;
ShapeFileFeatureSource MyShapeFileFeatureSource = new ShapeFileFeatureSource(strRutaMapaSHP, ShapeFileReadWriteMode.ReadOnly);
MyShapeFileFeatureSource.Open();
DataTable dtDatos = MyShapeFileFeatureSource.ExecuteQuery(strQuery);
MyShapeFileFeatureSource.Close();
C1GridViewDatos.DataSource = dtDatos;
C1GridViewDatos.DataBind();
Thanks in advance.
Get the feature.Id from ShapeFileFeatureSource.ExecuteQuery
Hi julieta h,
Thanks for your post and welcome to Map Suite forums!
Sorry to say ,we can’t get the feature id from this method as the feature id was generated at run-time based on the index file and the ExecuteQuery method doesn’t use the index file.
If there is any other question, don’t hesitate to let us know.
Thanks,
Johnny
Hello Johnny, thanks ,
Can you suggest any other method to do something like that ? is that possible using the querytools ?
Regards.
Hi,
The queryTool also uses the ExecuteQuery method in the end.
Here is a workaround I guess.We can insert a new “FeatureID” column into the shape file at the first and then we query it by GetFeaturesByColumnValue rather than the GetFeatureById.
I am not sure if it is ok for you.
Any questions please feel free to let us know.
Thanks,
Johnny