本文介绍了将包含900000 recods的.mbd文件导入到sql server中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 嗨朋友们, 我遇到了严重的问题我已经实现了文件上传功能,用户可以上传.mdb文件,有900000行记录。我想将.mdb文件导入mssql服务器数据库表。 当我导入.mdb文件时,在mdb文件中有100条记录,它成功导入到MSSQL服务器表中,但是当我导入时.mdb文件有900000条记录它会抛出 错误:超时已过期。操作完成前经过的超时时间或服务器没有响应。 我使用以下代码导入.mdb文件: 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( 从[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 throwserror:"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中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-23 22:34