bhavanisankarnimmala

Get the rows from table selection

Blog Post created by bhavanisankarnimmala on May 14, 2018

private bool SelectedTableRecord(ITable sampleReportsTable, string tableName)

{

bool flag = false;

#region Selection of Selected Records in Table

IStandaloneTableCollection pStTableColl = Globals.pmap as IStandaloneTableCollection;

for (int i = 0; i < pStTableColl.StandaloneTableCount; i++)

{

IStandaloneTable pStTable = pStTableColl.get_StandaloneTable(i);

if (pStTable.Name == tableName)

{

ITableSelection tableSelection = pStTable as ITableSelection;

ISelectionSet2 pSelSet = tableSelection.SelectionSet as ISelectionSet2;

if (pSelSet.Count == 1)

{

try

{

ICursor fea_cur;

pSelSet.Search(null, false, out fea_cur);

IRow row = null;

while ((row = fea_cur.NextRow()) != null)

{

Globals.reportID = row.get_Value(row.Fields.FindField("ID")).ToString();

}

Marshal.ReleaseComObject(fea_cur);

flag = true;

}

catch (Exception ex)

{

MessageBox.Show("Exception : " + ex.ToString(), "Select Total Agreement", MessageBoxButtons.OK, MessageBoxIcon.Error);

flag = false;

}

}

else

{

flag = false;

}

}

}

#endregion

return flag;

}

Outcomes