(1)网上示例
DataTable dt1 = new DataTable();
dt1 .Columns.Add("id");
dt1 .Columns.Add("name");
// dt1.Columns.Add("apname", typeof(string));
DataRow NewRow = dt1 .NewRow();
NewRow["id"] =strID1;
NewRow["name"] = strName1;
// Mydt.Rows.Add(NewRow);
(2)实际操作
dt.Columns.Add("invs_unit", typeof(string));
dt.Columns.Add("awb_remark", typeof(string));
dt.Columns.Add("inv_invoiceno", typeof(string));
dt.Columns.Add("awb_atacomp", typeof(string));
dt.Columns.Add("awb_seriesno", typeof(string));
dt.Columns.Add("invs_item", typeof(string));
dt.Columns.Add("invs_pono", typeof(string));
dt.Columns.Add("invs_quantity", typeof(string));
dt.Columns.Add("awb_mawb", typeof(string));
dt.Columns.Add("awb_hawb", typeof(string));
dt.Columns.Add("swb", typeof(string));
dt.Columns.Add("num", typeof(string));
dt.Columns.Add("buyer", typeof(string));
dt.Columns.Add("weight", typeof(string));
DataRow NewRow = dt.NewRow();
NewRow["invs_unit"] = "000138275479482C933781ABD8FFDA45";
NewRow["awb_remark"] = "S01WM23000978test";
NewRow["inv_invoiceno"] = "A102142288test";
NewRow["awb_atacomp"] = "";
NewRow["awb_seriesno"] = "S16AM12230591";
NewRow["invs_item"] = "69.14BAB.G01.Test";
NewRow["invs_pono"] = "230011101111";
NewRow["invs_quantity"] = "99999";
NewRow["awb_mawb"] = "";
NewRow["awb_hawb"] = "";
NewRow["swb"] = "";
NewRow["num"] = "0";
NewRow["buyer"] = "";
NewRow["weight"] = "500";
dt.Rows.Add(NewRow);