Database closing problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John

    #1

    Database closing problem

    Hi

    I have a vb.net app that opens an access database runs several sql action
    queries on the tables and closes the db. This is done every few minutes. The
    problem is that sometimes I get an error 'ExecuteNonQuer y requires an open
    and available Connection. The connection's current state is closed'. My
    question is; is there a situation where an app automatically closes the db
    connection causing this error and is there a way to prevent this?

    Thanks

    Regards


  • rowe_newsgroups

    #2
    Re: Database closing problem

    On May 3, 11:55 am, "John" <J...@nospam.in fovis.co.ukwrot e:
    Hi
    >
    I have a vb.net app that opens an access database runs several sql action
    queries on the tables and closes the db. This is done every few minutes. The
    problem is that sometimes I get an error 'ExecuteNonQuer y requires an open
    and available Connection. The connection's current state is closed'. My
    question is; is there a situation where an app automatically closes the db
    connection causing this error and is there a way to prevent this?
    >
    Thanks
    >
    Regards
    I'm guessing you are trying to use a global connection object right?

    If so, change the code to open a connection to the database, execute
    your commands, and then close/dispose of the command and connection.
    You should try to avoid using a "global" connection object at all
    costs as it can lead to serious problems (with very few benefits). If
    I guessed wrong, please post your code so I can take a look.

    Thanks,

    Seth Rowe


    Comment

    • John

      #3
      Re: Database closing problem

      Hi Seth

      It is true that I am opening a global connection. Executing only some of sql
      queries will cause problem with the integrity of the data in the database.
      By using a global connection I was hoping to provide a guaranteed connection
      to all queries reducing any expected problems. Is there a way to ensure that
      all queries get executed or none?

      Thanks

      Regards

      "rowe_newsgroup s" <rowe_email@yah oo.comwrote in message
      news:1178210814 .449498.96420@l 77g2000hsb.goog legroups.com...
      On May 3, 11:55 am, "John" <J...@nospam.in fovis.co.ukwrot e:
      >Hi
      >>
      >I have a vb.net app that opens an access database runs several sql action
      >queries on the tables and closes the db. This is done every few minutes.
      >The
      >problem is that sometimes I get an error 'ExecuteNonQuer y requires an
      >open
      >and available Connection. The connection's current state is closed'. My
      >question is; is there a situation where an app automatically closes the
      >db
      >connection causing this error and is there a way to prevent this?
      >>
      >Thanks
      >>
      >Regards
      >
      I'm guessing you are trying to use a global connection object right?
      >
      If so, change the code to open a connection to the database, execute
      your commands, and then close/dispose of the command and connection.
      You should try to avoid using a "global" connection object at all
      costs as it can lead to serious problems (with very few benefits). If
      I guessed wrong, please post your code so I can take a look.
      >
      Thanks,
      >
      Seth Rowe
      >
      >

      Comment

      • Cor Ligthert [MVP]

        #4
        Re: Database closing problem

        Is there a way to ensure that all queries get executed or none?
        >
        Follow the advice of Seth

        Cor

        "John" <John@nospam.in fovis.co.ukschr eef in bericht
        news:uaP11vajHH A.3120@TK2MSFTN GP05.phx.gbl...
        Hi Seth
        >
        It is true that I am opening a global connection. Executing only some of
        sql queries will cause problem with the integrity of the data in the
        database. By using a global connection I was hoping to provide a
        guaranteed connection to all queries reducing any expected problems. Is
        there a way to ensure that all queries get executed or none?
        >
        Thanks
        >
        Regards
        >
        "rowe_newsgroup s" <rowe_email@yah oo.comwrote in message
        news:1178210814 .449498.96420@l 77g2000hsb.goog legroups.com...
        >On May 3, 11:55 am, "John" <J...@nospam.in fovis.co.ukwrot e:
        >>Hi
        >>>
        >>I have a vb.net app that opens an access database runs several sql
        >>action
        >>queries on the tables and closes the db. This is done every few minutes.
        >>The
        >>problem is that sometimes I get an error 'ExecuteNonQuer y requires an
        >>open
        >>and available Connection. The connection's current state is closed'. My
        >>question is; is there a situation where an app automatically closes the
        >>db
        >>connection causing this error and is there a way to prevent this?
        >>>
        >>Thanks
        >>>
        >>Regards
        >>
        >I'm guessing you are trying to use a global connection object right?
        >>
        >If so, change the code to open a connection to the database, execute
        >your commands, and then close/dispose of the command and connection.
        >You should try to avoid using a "global" connection object at all
        >costs as it can lead to serious problems (with very few benefits). If
        >I guessed wrong, please post your code so I can take a look.
        >>
        >Thanks,
        >>
        >Seth Rowe
        >>
        >>
        >
        >

        Comment

        • dbahooker@hotmail.com

          #5
          Re: Database closing problem

          CORRECTION!

          Seth is full of crap
          Take your egocentric way of living and shove it up your ass

          in ADO classic, we used to be able to open a connection; and close a
          connection-- we used to be able to have multiple recordsets on the
          same connection

          now all we got is bloatware

          We used to be able to run ADO commands FROM THE CLIENTSIDE OF THE WEB
          BROWSER
          this is no longer possible

          screw ADO.net





          \
          On May 3, 9:46 am, rowe_newsgroups <rowe_em...@yah oo.comwrote:
          On May 3, 11:55 am, "John" <J...@nospam.in fovis.co.ukwrot e:
          >
          Hi
          >
          I have a vb.net app that opens an access database runs several sql action
          queries on the tables and closes the db. This is done every few minutes. The
          problem is that sometimes I get an error 'ExecuteNonQuer y requires an open
          and available Connection. The connection's current state is closed'. My
          question is; is there a situation where an app automatically closes the db
          connection causing this error and is there a way to prevent this?
          >
          Thanks
          >
          Regards
          >
          I'm guessing you are trying to use a global connection object right?
          >
          If so, change the code to open a connection to the database, execute
          your commands, and then close/dispose of the command and connection.
          You should try to avoid using a "global" connection object at all
          costs as it can lead to serious problems (with very few benefits). If
          I guessed wrong, please post your code so I can take a look.
          >
          Thanks,
          >
          Seth Rowe

          Comment

          • dbahooker@hotmail.com

            #6
            Re: Database closing problem

            Cor;

            stfu and make microsoft fix the BUG






            On May 3, 10:28 pm, "Cor Ligthert [MVP]" <notmyfirstn... @planet.nl>
            wrote:
            Is there a way to ensure that all queries get executed or none?
            >
            Follow the advice of Seth
            >
            Cor
            >
            "John" <J...@nospam.in fovis.co.ukschr eef in berichtnews:uaP 11vajHHA.3120@T K2MSFTNGP05.phx .gbl...
            >
            >
            >
            Hi Seth
            >
            It is true that I am opening a global connection. Executing only some of
            sql queries will cause problem with the integrity of the data in the
            database. By using a global connection I was hoping to provide a
            guaranteed connection to all queries reducing any expected problems. Is
            there a way to ensure that all queries get executed or none?
            >
            Thanks
            >
            Regards
            >
            "rowe_newsgroup s" <rowe_em...@yah oo.comwrote in message
            news:1178210814 .449498.96420@l 77g2000hsb.goog legroups.com...
            On May 3, 11:55 am, "John" <J...@nospam.in fovis.co.ukwrot e:
            >Hi
            >
            >I have a vb.net app that opens an access database runs several sql
            >action
            >queries on the tables and closes the db. This is done every few minutes.
            >The
            >problem is that sometimes I get an error 'ExecuteNonQuer y requires an
            >open
            >and available Connection. The connection's current state is closed'. My
            >question is; is there a situation where an app automatically closes the
            >db
            >connection causing this error and is there a way to prevent this?
            >
            >Thanks
            >
            >Regards
            >
            I'm guessing you are trying to use a global connection object right?
            >
            If so, change the code to open a connection to the database, execute
            your commands, and then close/dispose of the command and connection.
            You should try to avoid using a "global" connection object at all
            costs as it can lead to serious problems (with very few benefits). If
            I guessed wrong, please post your code so I can take a look.
            >
            Thanks,
            >
            Seth Rowe- Hide quoted text -
            >
            - Show quoted text -

            Comment

            • Mark

              #7
              Re: Database closing problem

              On Thu, 3 May 2007 18:53:27 +0100, "John" <John@nospam.in fovis.co.uk>
              wrote:
              >Hi Seth
              >
              >It is true that I am opening a global connection. Executing only some of sql
              >queries will cause problem with the integrity of the data in the database.
              >By using a global connection I was hoping to provide a guaranteed connection
              >to all queries reducing any expected problems. Is there a way to ensure that
              >all queries get executed or none?
              Use a proper database?

              google: "ado.net transactions"

              Comment

              Working...