praveen1981
asked on
Static class
Hi
I required one clarification among the followig.
can i use the connection pooling instead of static class, where connection pooling
will return the same object for same connectionstring and static class will return
the same object.
if so In what situation i have to use each of them.
I required one clarification among the followig.
can i use the connection pooling instead of static class, where connection pooling
will return the same object for same connectionstring and static class will return
the same object.
if so In what situation i have to use each of them.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Read carefully, I am saying the reverse: "unless you add special instructions"
If you do not use MARS, the following will create 2 connections, even if both objects have the exact same connection string:
con1.Open
...
con2.Open
...
con2.Close
con1.Close
But if you set MARS in the connection string, the pooling will use the same connection for both.
If you do not use MARS, the following will create 2 connections, even if both objects have the exact same connection string:
con1.Open
...
con2.Open
...
con2.Close
con1.Close
But if you set MARS in the connection string, the pooling will use the same connection for both.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for your clarifications.
Your comment is not clear. Are you saying that MARS uses multiple connections? If so, then that is not what I am reading in the documentation.