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. two commands are possible

two commands are possible

Scheduled Pinned Locked Moved C#
question
3 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.
  • S Offline
    S Offline
    srinivassam
    wrote on last edited by
    #1

    In one connection i want to take two sqlcommands cmd1 and cmd2 is it possible ?????????????? srinivas

    N M 2 Replies Last reply
    0
    • S srinivassam

      In one connection i want to take two sqlcommands cmd1 and cmd2 is it possible ?????????????? srinivas

      N Offline
      N Offline
      Nisar Inamdar
      wrote on last edited by
      #2

      :cool:hi, yes............... you can do it............... nisar inamdar

      1 Reply Last reply
      0
      • S srinivassam

        In one connection i want to take two sqlcommands cmd1 and cmd2 is it possible ?????????????? srinivas

        M Offline
        M Offline
        Mike Dimmick
        wrote on last edited by
        #3

        It depends on your database, .NET Framework version, and connection string. In any version of SQL Server and .NET Framework, you can execute as many commands as you like on one connection, as long as you close the first data reader before opening the next one. In SQL Server 2000, and .NET Framework 1.1 connecting to SQL Server 2005, you cannot execute any commands when you have a SqlDataReader open on the same connection. If using .NET Framework 2.0 with SQL Server 2005, you can use a new feature called Multiple Active Result Sets (MARS). The connection string option to control this is called MultipleActiveResultSets. It's enabled by default, but it does use more resources on the server. If you execute commands on different connections, SQL Server will consider them as commands from different clients and you can end up blocking or deadlocking your own code. It's generally recommended to keep connections open for the minimum time possible - the length of a transaction, which is recommended to be short. If connection pooling is turned on (as it is by default) you will normally still get back a connection object that is still actually connected to the server, so you don't pay the cost of connecting to the server again.

        Stability. What an interesting concept. -- Chris Maunder

        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