如何添加新行和项目 [英] How to add new row and items
本文介绍了如何添加新行和项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的所有人,
我想创建一个数据表,然后向其中添加行,然后添加项目.
请帮帮我
问候,
Mohi
Dear All,
i want to create a datatable and then add rows to it and then the items.
Please help me
Regards,
Mohi
推荐答案
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
这篇关于如何添加新行和项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文