如何使用c#在数据库表中插入Arraylist值 [英] How to insert the Arraylist Value in the Database Table using c#
本文介绍了如何使用c#在数据库表中插入Arraylist值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
海,
如何使用c#在数据库表中插入Arraylist值.
我正在使用SqlServer2005.
Hai,
How to insert the Arraylist Value in the Database Table using c#.
I am using SqlServer2005.
推荐答案
以下是几个将arraylist代码转换为DataTable的链接.
http://syntaxhelp.com/CS.NET/Database/Arraylist-to-datatable [ ^ ]
http://www.dotnetspider.com/resources/2711-Transfer-e-data-an-Arraylist-into-e-Datata.aspx [
Here are a couple of links that convert arraylist code into a DataTable.
http://syntaxhelp.com/CS.NET/Database/Arraylist-to-datatable[^]
http://www.dotnetspider.com/resources/2711-Transfer-e-data-an-Arraylist-into-e-Datata.aspx[^]
for(int k=0;k<array.count;k++)>
{
cn.Open();
cmd = new SqlCommand("insert into tbl values('"+array[k]+"')",cn);
cmd.ExecuteNonQuery();
MessageBox.Show("inserted successfully!!!");
cn.Close();
}
这篇关于如何使用c#在数据库表中插入Arraylist值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文