asp.net populating, working with datatable objects

satya - Friday, May 18, 2007 4:23:52 PM

working with groupby and datasets

working with groupby and datasets

satya - Friday, May 18, 2007 5:17:13 PM

creating an empty datatable


private DataSet getEmptyDataSet(int numOfColumns)
    {
        DataTable dt = new DataTable();
        for(int i=0;i<numOfColumns;i++)
        {
            DataColumn dc = new DataColumn("col" + i);
            dt.Columns.Add(dc);
        }
        DataRow dr = dt.NewRow();
        for (int i = 0; i < numOfColumns; i++)
        {
            dr[i] = "col" + i;
        }
        dt.Rows.Add(dr);
        DataSet ds = new DataSet();
        ds.Tables.Add(dt);
        return ds;
    }

satya - Friday, May 18, 2007 5:17:54 PM

you can not new a datarow but has to ask the datatable to create it

you can not new a datarow but has to ask the datatable to create it

satya - Friday, May 18, 2007 5:18:21 PM

You can not index into the collection but you have to use the explicit add function

You can not index into the collection but you have to use the explicit add function