insert too slow????
-
Hi everybody, I want to insert thousands of rows into an Access database, I use OleDbCommand to execute the insert sql, but it works pretty slow, is there any good way to solve the problem? Thanks for any help in advance! Alan Alan Shen MCAD for .NET Version ^~^~^~^~^~^~^~^~^~^~^ Great idea is the beginging of success!
-
Hi everybody, I want to insert thousands of rows into an Access database, I use OleDbCommand to execute the insert sql, but it works pretty slow, is there any good way to solve the problem? Thanks for any help in advance! Alan Alan Shen MCAD for .NET Version ^~^~^~^~^~^~^~^~^~^~^ Great idea is the beginging of success!
Actually, in my experience whery big ammount of inserts is allways not too fast, especially if you are executing it in some kind of for() or while() cycle. Some time ago I created a 2D map in database where insert was wery simple like that: insert (x,y, ) values (1,2,34). In my case I used 2 for() cycles and OdbcConnection with OdbcCommand. insert statement was executed 1`000`000 times and it took 15-20 minutes because someMapType was Random generated number. I suggest you have to check and try optimize your code, maybe even create transaction sql file and execute it in database side with you oledb. And there is one more thing - Access is the sickest database I ever seen. Maybe you should try some other database.