将包含900000 recods的.mbd文件导入到sql server中? [英] Import a .mbd file having 900000 recods in table in to sql server?
问题描述
嗨朋友们,
我遇到了严重的问题我已经实现了文件上传功能,用户可以上传.mdb文件,有900000行记录。我想将.mdb文件导入mssql服务器数据库表。
当我导入.mdb文件时,在mdb文件中有100条记录,它成功导入到MSSQL服务器表中,但是当我导入时.mdb文件有900000条记录它会抛出
错误:超时已过期。操作完成前经过的超时时间或服务器没有响应。
我使用以下代码导入.mdb文件:
< pre lang =cs> OleDbConnection excelConnection = null ;
OleDbCommand cmd = null ;
string excelConnectionString =
@ Provider = Microsoft.Jet.OLEDB.4.0; Data Source = E:\ Rakeshkumar \ Uploads \ test.mdb; Persist Security Info ='False';
excelConnection = new OleDbConnection(excelConnectionString);
// cmd = new OleDbCommand(Select * from [test],excelConnection) ;
// cmd.CommandTimeout = 0;
< span class =code-comment> // excelConnection.Open();
OleDbDataAdapter da = new OleDbDataAdapter( 从[test]选择* ,excelConnection);
DataTable ds = new DataTable();
SqlBulkCopy sqlBulk = new SqlBulkCopy(strConnection);
sqlBulk.WriteToServer(ds);
excelConnection.Close();
这是导入大型记录(900000行)到MSsql服务器的正确解决方案?如果有任何最佳解决方案请尽快告诉我。
一次执行以2000条记录为单位的导入。
Hi friends,
I am stuck in serious issue I have implemented a fileupload functionality where user can upload .mdb file having 900000 rows record. I want to Import that .mdb file into mssql server database table.
When I am import .mdb file with having 100 records in. mdb file it imported successfully into MSSQL server table, But when I am import .mdb file having 900000 records it throws
error:"Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding."
I have used following code to import .mdb file:
OleDbConnection excelConnection = null;
OleDbCommand cmd = null;
string excelConnectionString =
@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Rakeshkumar\Uploads\test.mdb;Persist Security Info='False'";
excelConnection = new OleDbConnection(excelConnectionString);
// cmd = new OleDbCommand("Select * from [test]", excelConnection);
// cmd.CommandTimeout = 0;
// excelConnection.Open();
OleDbDataAdapter da = new OleDbDataAdapter("Select * from [test]", excelConnection);
DataTable ds = new DataTable();
SqlBulkCopy sqlBulk = new SqlBulkCopy(strConnection);
sqlBulk.WriteToServer(ds);
excelConnection.Close();
Is this is a proper solution for import large Records(900000 rows) into MSsql server?If there any optimal solution pls tell me ASAP.
Do the import in blocks of say 2000 records at a time.
这篇关于将包含900000 recods的.mbd文件导入到sql server中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!