Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. insert too slow????

insert too slow????

Scheduled Pinned Locked Moved .NET (Core and Framework)
databasehelpcsharpquestionannouncement
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Small Rat
    wrote on last edited by
    #1

    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!

    O 1 Reply Last reply
    0
    • S Small Rat

      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!

      O Offline
      O Offline
      Oskars
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups