I am building data table like this below and when i trying to assign a values to database on row by row basis i am getting error like this
there is no row at position 0
and this is my code:
public DataTable BuildCertInfo()
{
DataTable dtCertInfo = new DataTable(TABLE);
DataColumnCollection columns;
columns = dtCertInfo.Columns;
AddColumn(dtCertInfo, ROW_NO, "System.Int32", false, 0);
AddColumn(dtCertInfo, LIC_ID, "System.Int32", false, 0);
AddColumn(dtCertInfo, SYS_ID, "System.Int32", false, 0);
AddColumnString(dtCertInfo, SYS_PART_ID);
...............
...............
return dtCertInfo;
}
and i am calling above method like this
DataTable dt = objCertificate.BuildCertInfo();
and then i am looping through the gridview and assigning values to data table like below ..
for (int i = 0; i < gvPRCertInfo.Rows.Count; i++)
{
dt.Rows[i][Certificate.SYS_PART_ID] = systemPartID; // here I am getting error
................
................
}
I am not sure where i am doing wrong could any please point me in right direction that would very grateful to me
many thanks in advance ...