tags:

views:

65

answers:

2

I am trying to add data to a newly created column...

DataSet ds = new DataSet;
ds.Tables[0].Columns.Add("Count");
Data.DataSource = ds;
Data.DataBind();

Where do I add, a hardcoded count? (I want count column to have '4')

+1  A: 

You add data to rows - so:

    DataSet ds = new DataSet();
    DataTable table = ds.Tables.Add();
    table.Columns.Add("Count", typeof(int));
    table.Rows.Add(4);

However, there are probably easier options; a DataSet seems massively overkill to bind a single value.

Marc Gravell
A: 

It technically is a repeater function but if I get the hardcoded function... I can make the code to make it flexible. I got it to work. I was adding a column to an existing table. This is what I did...

for int i=0; i<ds.tables[0].Rows.Count; i++)
{
    ds.tables[0].Rows[i]["Count"] = "4";
}