Can someone see what is wrong with the code below?

  • Thread starter Thread starter jensen bredal
  • Start date Start date
J

jensen bredal

********************
DataTable SampleTable = new DataTable();

//DataAdapter fill code in here.

DataColumn ExpressionColumn = new DataColumn("Indexer",
typeof(System.Int32));

ExpressionColumn.AutoIncrement = true;

ExpressionColumn.AutoIncrementStep = 1;//It defaults to 1 - I just put it
here for clarity

ExpressionColumn.AutoIncrementSeed = 0;//Again, it defaults to this - I just
included it for clarity

DataView SampleView = SampleTable.DefaultView;

SampleView.RowFilter = "Indexer < " + topValue.ToString();

//You may want to include a minValue as well and change the rowfilter so
that you can specify other

//ranges, but by defaulting to 0 - you'll effectively have your Top
Condition

}
***********************
i'm expecting the ExpressionColumn of SampleView to contain 0,1,2......n

instead i get System.DBNull.

What is wrong?

Thanks

JB
 
Omited that "ExpressionColumn" column is added to SampleTable.

SampleTable.Column.Add(ExpressionColumn);
 
Back
Top