This... Let me leave it alone. It is purely written and playful.
Method 1:
Code
DataTable tblDatas = new DataTable ("Datas ");
DataColumn dc = null;
Dc = tblDatas. Columns. Add ("ID", Type. GetType ("System. Int32 "));
Dc. AutoIncrement = true; // automatically add
Dc. AutoIncrementSeed = 1; // start with 1
Dc. AutoIncrementStep = 1; // The step size is 1.
Dc. AllowDBNull = false ;//
Dc = tblDatas. Columns. Add ("Product", Type. GetType ("System. String "));
Dc = tblDatas. Columns. Add ("Version", Type. GetType ("System. String "));
Dc = tblDatas. Columns. Add ("Description", Type. GetType ("System. String "));
DataRow newRow;
NewRow = tblDatas. NewRow ();
NewRow ["Product"] = "fruit knife ";
NewRow ["Version"] = "2.0 ";
NewRow ["Description"] = "Fight dedicated ";
TblDatas. Rows. Add (newRow );
NewRow = tblDatas. NewRow ();
NewRow ["Product"] = "folding stool ";
NewRow ["Version"] = "3.0 ";
NewRow ["Description"] = "one of the seven weapons in jianghu ";
TblDatas. Rows. Add (newRow );
Method 2:
Code
DataTable tblDatas = new DataTable("Datas");
tblDatas.Columns.Add("ID", Type.GetType("System.Int32"));
tblDatas.Columns[0].AutoIncrement = true;
tblDatas.Columns[0].AutoIncrementSeed = 1;
tblDatas.Columns[0].AutoIncrementStep = 1;
tblDatas.Columns.Add("Product", Type.GetType("System.String"));
tblDatas.Columns.Add("Version", Type.GetType("System.String"));
tblDatas.Columns.Add("Description", Type.GetType("System.String"));
tblDatas.Rows.Add(new object[]{null,"a","b","c"});
tblDatas.Rows.Add(new object[] { null, "a", "b", "c" });
tblDatas.Rows.Add(new object[] { null, "a", "b", "c" });
tblDatas.Rows.Add(new object[] { null, "a", "b", "c" });
tblDatas.Rows.Add(new object[] { null, "a", "b", "c" });