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. Web Development
  3. ASP.NET
  4. Connection state with DataAdapter.Fill()

Connection state with DataAdapter.Fill()

Scheduled Pinned Locked Moved ASP.NET
databasesysadminquestion
5 Posts 4 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.
  • R Offline
    R Offline
    ranandbe
    wrote on last edited by
    #1

    :omg:hi, I confused with sql database connection state for SqlDataAdapter.Fill() method. SqlDataAdapter retrieve the data from database with closed connection with server exception "Invalid operation ..." but it won’t throw that exception. How it works?.. Plz clear my doubt.

    friendly, ranandbe

    J P A 3 Replies Last reply
    0
    • R ranandbe

      :omg:hi, I confused with sql database connection state for SqlDataAdapter.Fill() method. SqlDataAdapter retrieve the data from database with closed connection with server exception "Invalid operation ..." but it won’t throw that exception. How it works?.. Plz clear my doubt.

      friendly, ranandbe

      J Offline
      J Offline
      John ph
      wrote on last edited by
      #2

      ranandbe wrote:

      I confused with sql database connection state for SqlDataAdapter.Fill() method

      There's no need of any explicit open and close of the Database Connection when you use SQLDataAdapter. SQLDataAdapter will handle that for you. The DataAdapter will implicitly open the connection when it has to retrieve the Data and Close the connection Once it is done.

      - Regards -
         JON


      Life is not measured by the amount of breaths we take, but by the moments that take our breath away.


      1 Reply Last reply
      0
      • R ranandbe

        :omg:hi, I confused with sql database connection state for SqlDataAdapter.Fill() method. SqlDataAdapter retrieve the data from database with closed connection with server exception "Invalid operation ..." but it won’t throw that exception. How it works?.. Plz clear my doubt.

        friendly, ranandbe

        P Offline
        P Offline
        Prateek G
        wrote on last edited by
        #3

        Fill() method automatically open the connection and again disconnect after execution in case connection was not oper prior to execution of Fill() method, In case connection was open you will have close it manually.

        R 1 Reply Last reply
        0
        • R ranandbe

          :omg:hi, I confused with sql database connection state for SqlDataAdapter.Fill() method. SqlDataAdapter retrieve the data from database with closed connection with server exception "Invalid operation ..." but it won’t throw that exception. How it works?.. Plz clear my doubt.

          friendly, ranandbe

          A Offline
          A Offline
          aswini
          wrote on last edited by
          #4

          since data adapter works with disconnected architecture.... data adaper opens and close connection automatically

          Aswini

          1 Reply Last reply
          0
          • P Prateek G

            Fill() method automatically open the connection and again disconnect after execution in case connection was not oper prior to execution of Fill() method, In case connection was open you will have close it manually.

            R Offline
            R Offline
            ranandbe
            wrote on last edited by
            #5

            Thanks for your information.

            friendly, ranandbe

            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