two commands are possible
-
In one connection i want to take two sqlcommands cmd1 and cmd2 is it possible ?????????????? srinivas
-
In one connection i want to take two sqlcommands cmd1 and cmd2 is it possible ?????????????? srinivas
:cool:hi, yes............... you can do it............... nisar inamdar
-
In one connection i want to take two sqlcommands cmd1 and cmd2 is it possible ?????????????? srinivas
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