且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何添加新行和项目

更新时间:2023-12-03 11:17:52

http://www.dotnetperls.com/datatable- vbnet [ ^ ]

http://www.vb-helper.com/howto_net_runtime_datatable.html [
http://www.dotnetperls.com/datatable-vbnet[^]

http://www.vb-helper.com/howto_net_runtime_datatable.html[^]



试试这个:
Hi,
Try this:
System.Data.DataTable table = new DataTable("ParentTable");
table.Columns.Add("CustLName", typeof(String));
table.Columns.Add("CustFName", typeof(String));
table.Columns.Add("Purchases", typeof(int));
DataRow newRow = table.NewRow();

newRow["CustLName"] = "Kumar";
newRow["CustFName"] = "Amit";
newRow["Purchases"] = "1452";

table.Rows.Add(newRow);



请参考以下链接:
MSDN:数据表类 [ MSDN:将列添加到表中 [ ^ ]
MSDN:如何:向数据表添加行 [ ^ ]


祝一切顺利.
--Amit



Refer the links below:
MSDN : DataTable Class[^]
MSDN : Adding Columns to a Table[^]
MSDN : How to: Add Rows to a DataTable[^]


All the best.
--Amit