我爱Aspx >> Asp.Net >> .net2.0中使用SqlBulkCopy进行大批量数据迁移在.Net1.1中无论是对于批量插入整个DataTable中的所有数据到数据库中,还是进行不同数据源之间的迁移,都不是很方便。而在.Net2.0中,SQLClient命名空间下增加了几个新类帮助我们通过DataTable或DataReader批量迁移数据。数据源可以来自关系数据库或者XML文件,甚至WebService返回结果。其中最重要的一个类就是SqlBulkCopy类,使用它可以很方便的帮助我们把数据源的数据迁移到目标数据库中。
下面我们先通过一个简单的例子说明这个类的使用:
DateTime startTime;
protected void Button1_Click(object sender, EventArgs e)
{
startTime = DateTime.Now;
string SrcConString;
string DesConString;
SqlConnection SrcCon = new SqlConnection();
SqlConnection DesCon = new SqlConnection();
SqlCommand SrcCom = new SqlCommand();
SqlDataAdapter SrcAdapter = new SqlDataAdapter();
DataTable dt = new DataTable();
SrcConString =
ConfigurationManager.ConnectionStrings["SrcDBConnectionString"].ConnectionString;
DesConString =
ConfigurationManager.ConnectionStrings["DesDBConnectionString"].ConnectionString;
Ҷƪл˵?
用ASP.NET 2.0设计网络在线投票系..[08-01]
ASP.NET中实现模板页[08-01]
查询数据库表和字段sql语句[08-01]
将文本文件导入Sql server数据库[08-01]
连接到 SQL Server 2005 时出现的..[08-01]
ASP.NET 2.0中XSLT的使用[08-01]
.Net2.0 使用ConfigurationManag..[08-01]
.net 做的IP 访问限制[08-01]
ASP.Net2.0 GridView 多列排序,..[08-01]
ASP.NET2.0数据库入门之常见错误[08-01]
Google电子表格Spreadsheets全面..[08-01]
让FlashGet与Netants“共享资源”[08-01]
Photoshop为风景照片增添柔焦梦幻..[08-01]
优化网站的20条重要体会[08-01]
用ASP.NET 2.0设计网络在线投票系..[08-01]
ASP.NET中实现模板页[08-01]
查询数据库表和字段sql语句[08-01]
总结showModalDialog和showModel..[08-01]
将文本文件导入Sql server数据库[08-01]
windows server 2003 r2 64位web..[08-01]