With this code:
OracleDataTable dt = PlatypusSchedData.GetAvailablePlatypi();
OracleDataTable outputDt = new OracleDataTable();
int iRows = 12;
while (iRows > 0)
{
outputDt.Rows.Add(new DataRow());
iRows -= 1;
}
for (int i = 0; i < dt.Rows.Count; i += 1) {
DataRow dr = dt.Rows[i];
int outputColumn = 0;
if (i % 12 == 0 && i > 0) {
outputColumn += 1;
}
outputDt.Rows[i % 12][outputColumn] = dr[0];
outputDt.Rows[i % 12][outputColumn + 1] = dr[1];
}
dataGridView1.DataSource = outputDt;
... I get this compile-time error using either line 1 (lines 2a and 2b are commented out) or using lines 2a and 2b (with line 1 missing):
'System.Data.DataRow.DataRow (System.Data.DataRowBuilder)' is unavailable due to the level of protection
This puzzles me, because a DataRow in a for loop is allowed. How can I add these DataRows to my OracleDataTable?
source
share