Skip to main content
RSS feed Subscribe to feed

 

Accessing Row Values

Code example showing how to access the row values of one string and one integer column.

// Create value cursors
DataTable table = myExistingTable;
DataValueCursor<string> aCursor = DataValueCursor.Create<string>(columns["A"]);
DataValueCursor<int> cCursor = DataValueCursor.Create<int>(columns["C"]);
DataValueCursor[] valueCursors = new DataValueCursor[] { aCursor, cCursor };

// Loop through all rows using DataTable.GetRows 
foreach(DataRow row in table.GetRows(valueCursors))
{
    string s = aCursor.CurrentValue;
    int i = cCursor.CurrentValue;
    DoSomething(s, i);
}