1、必须是sqlserver数据库
2、
Dim tran As System.Data.SqlClient.SqlTransaction
try
Dim conn As new System.Data.SqlClient.SqlConnection("server=voyo;uid=sa;pwd=hailun.;database=Test")
conn.Open() \'打开链接
tran = conn.BeginTransaction()
Dim mapping1 As new System.Data.SqlClient.SqlBulkCopyColumnMapping("第一列", "第一列")
Dim mapping2 As new System.Data.SqlClient.SqlBulkCopyColumnMapping("第二列", "第二列")
Dim copy As new System.Data.SqlClient.SqlBulkCopy(conn, System.Data.SqlClient.SqlBulkCopyOptions.Default, tran)
Copy.ColumnMappings.Add(mapping1)
Copy.ColumnMappings.Add(mapping2)
copy.DestinationTableName = "表D" \'指定服务器上目标表的名称
copy.WriteToServer(DataTables("表D").basetable) \'你的datatable名字,执行把DataTable中的数据写入DB
tran.Commit() \'提交事务
msgbox("OK")
catch ex As exception
msgbox(ex.message)
tran.Rollback() \'返回False 执行失败!
End try