SqlDataAdapter dAd = new SqlDataAdapter(); DataTable dTable = new DataTable(); DataSet dSet = new DataSet(); ---- --- dAd.Fill(dTable); // will also work dAd.Fill(dSet); // will also work
DataView dView = new DataView(dTable);
DataTable dTable = new DataTable(); DataRow row = null; for (int i = 0; i < 5; i++) { row = dTable.NewRow (); row["Name"] = i + " - Raja"; row["Address"] = "USA"; dTable.Rows.Add(row); }
DataTable dTable = new DataTable(); // create another column DataColumn name = new DataColumn("Name", typeof(string)); dTable.Columns.Add(name);
// create columns for the DataTable DataTable dTable = new DataTable(); DataColumn auto = new DataColumn("AutoID", typeof(System.Int32)); dTable.Columns.Add(auto); // specify it as auto increment field auto.AutoIncrement = true; auto.AutoIncrementSeed = 1; auto.ReadOnly = true;