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. C#
  4. open a connection with the database

open a connection with the database

Scheduled Pinned Locked Moved C#
questiondatabaseperformance
4 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.
  • M Offline
    M Offline
    mhmo
    wrote on last edited by
    #1

    Hi I am currently writting a program that read a file which contains some information. I will enter a loop that will loop 10000 or even 25000 times(depending on the number of lines)to enter these information. Now, is it a good practice to open the connection to the database and close it within the loop.So it will be opened and closed each loop.If not, what is the best solution?! I mean, will it affect the time performance?? My database is MS Access 2003 Thanks

    R 1 Reply Last reply
    0
    • M mhmo

      Hi I am currently writting a program that read a file which contains some information. I will enter a loop that will loop 10000 or even 25000 times(depending on the number of lines)to enter these information. Now, is it a good practice to open the connection to the database and close it within the loop.So it will be opened and closed each loop.If not, what is the best solution?! I mean, will it affect the time performance?? My database is MS Access 2003 Thanks

      R Offline
      R Offline
      Robert Rohde
      wrote on last edited by
      #2

      I think it would. I'd just open the connection right before you start the loop and close it afterwards.

      M 1 Reply Last reply
      0
      • R Robert Rohde

        I think it would. I'd just open the connection right before you start the loop and close it afterwards.

        M Offline
        M Offline
        mhmo
        wrote on last edited by
        #3

        Thanks I will try :) Q:Where can I find a reference that shows me when I should use the executeQueri() method and when I shold use the execute() method of the database? regards

        R 1 Reply Last reply
        0
        • M mhmo

          Thanks I will try :) Q:Where can I find a reference that shows me when I should use the executeQueri() method and when I shold use the execute() method of the database? regards

          R Offline
          R Offline
          Robert Rohde
          wrote on last edited by
          #4

          Sorry I dont know what exactly you mean. Do you refer to the different Execute functions the IDbCommand interface has? If yes then look here.

          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