[Visual Basic 6.0]
[C#]public void TableSearch(string sde1CS, string tableName, string versionName, string whereClause)
{
// Direct connect
IGeoDataServerInit gds1 = new GeoDataServerClass();
gds1.InitFromConnectionString(sde1CS);// Setup query filter
IQueryFilter qf = new QueryFilterClass();
qf.WhereClause = whereClause;// Setup ResultPortionInfo
IResultPortionInfo range = new ResultPortionInfoClass();
range.StartIndex = 0; //Controls the start index for count
range.Count = (gds1.MaxRecordCount / 10); //Set the query to retrieve the result in chunks 1/10th of the maximum allowed by the GeoDataServerIGeoDataServer gds = (IGeoDataServer)gds1;// Do TableSearch
IGDSQueryResultPortion res = gds.TableSearch(versionName, tableName, qf, range);// Print OID's of the results
ICursor cursor = res.Records.get_Cursor(true);
IRow row = cursor.NextRow();
while (row != null)
{
Console.WriteLine(row.OID);
row = cursor.NextRow();
}// Setup IResultPortion
IResultPortion resP = (IResultPortion)res;
IResultPortionInfo resInfo = resP.ResultPortionInfo;
// Loop to keep Getting the next result portion until you have gotten them all
while (range.Count == resInfo.Count)
{
range.StartIndex = (range.StartIndex + resInfo.Count);
res = gds.GetNextResultPortion(range);
// Print OID's of the results
cursor = res.Records.get_Cursor(true);
row = cursor.NextRow();
while (row != null)
{
Console.WriteLine(row.OID);
row = cursor.NextRow();
}
resP = (IResultPortion)res;
resInfo = resP.ResultPortionInfo;
}
}
[Visual Basic .NET, C++]
No example is available for Visual Basic .NET or C++. To view a Visual Basic 6.0 or C# example, click the Language Filter button
in the upper-left corner of the page.