Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2430
Getting a Key not found error on (breakdownGrid.DataSource = src;)
posted

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Below is source code:  but not certain why I am getting a Key not found - tried Binding at Runtime to datasource without any schema defined.  Also defined schema and no use.

 

UltraDataSource src = new UltraDataSource();

src.Band.Columns.Add(

"Phase");

src.Band.Columns.Add(

"Unit Code");

src.Band.Columns.Add(

"Unit Description");

src.Band.Columns.Add(

"Maintainable Items", Type.GetType("System.Nullable`1[System.Int32]"));

src.Band.Columns.Add(

"Technology Type Assigned", Type.GetType("System.Nullable`1[System.Int32]"));

src.Band.Columns.Add(

"Size Assigned", Type.GetType("System.Nullable`1[System.Int32]"));

src.Band.Columns.Add(

"Service Assigned", Type.GetType("System.Nullable`1[System.Int32]"));

src.Band.Columns.Add(

"FMECA Assigned", Type.GetType("System.Nullable`1[System.Int32]"));

 

while(reader.Read())

{

 

string sPhase = reader[0].ToString();

 

string sUnitCode = reader[1].ToString();

 

string sUnitDesc = reader[2].ToString();

 

int iTotal = reader.GetInt32(3);

 

int iTTTotal = reader.GetInt32(4);

 

int iSizeTotal = reader.GetInt32(5);

 

int iServiceTotal = reader.GetInt32(6);

 

int iFMECATotal = reader.GetInt32(7);

 

object[] values = { sPhase, sUnitCode, sUnitDesc, iTotal, iTTTotal, iSizeTotal, iServiceTotal, iFMECATotal };

src.Band.DataSource.Rows.Add(values);

}

reader.Close();

breakdownGrid.DataSource = src;

Parents
No Data
Reply
  • 469350
    Offline posted

    My guess is that the exception is occurring in a grid event like InitializeLayout or InitializeRow and your code is trying to refer to a column that does not exist.

Children