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. Opened datareader

Opened datareader

Scheduled Pinned Locked Moved C#
question
4 Posts 3 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
    Razvan Dimescu
    wrote on last edited by
    #1

    Hello, Is there a way to find out if there is an opened data reader associated with a given connection. I searched through all properties of the SqlCommand and it's associated SqlConnection, but I could't find anything is there a way to find out? Thank you!

    drinking beer is fun :)

    S S 2 Replies Last reply
    0
    • R Razvan Dimescu

      Hello, Is there a way to find out if there is an opened data reader associated with a given connection. I searched through all properties of the SqlCommand and it's associated SqlConnection, but I could't find anything is there a way to find out? Thank you!

      drinking beer is fun :)

      S Offline
      S Offline
      Sylvester george
      wrote on last edited by
      #2

      you can check it in sql server query analyser by using this query SELECT * FROM master.dbo.sysprocesses WHERE DB_NAME(dbid) = 'DATABASE NAME'

      Regards, Sylvester G If we don't succeed, we run the risk of failure

      1 Reply Last reply
      0
      • R Razvan Dimescu

        Hello, Is there a way to find out if there is an opened data reader associated with a given connection. I searched through all properties of the SqlCommand and it's associated SqlConnection, but I could't find anything is there a way to find out? Thank you!

        drinking beer is fun :)

        S Offline
        S Offline
        ScottM1
        wrote on last edited by
        #3

        Hi I assume you want to do this to prevent the error about Multiple Active Result Sets on one connection by checking if the connection already has an open DataReader, and if it does, closing it. If this is the case set MultipleActiveResultSets = true in your connection string to allow you to have more than one open DataReader on a connection. If it isn't please describe in more detail what you are trying to do.

        There are 10 types of people in the world, those who understand binary and those who dont.

        R 1 Reply Last reply
        0
        • S ScottM1

          Hi I assume you want to do this to prevent the error about Multiple Active Result Sets on one connection by checking if the connection already has an open DataReader, and if it does, closing it. If this is the case set MultipleActiveResultSets = true in your connection string to allow you to have more than one open DataReader on a connection. If it isn't please describe in more detail what you are trying to do.

          There are 10 types of people in the world, those who understand binary and those who dont.

          R Offline
          R Offline
          Razvan Dimescu
          wrote on last edited by
          #4

          Indeed that was the reason i was asking for help :) Thank you, regards!

          drinking beer is fun :)

          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