D
Danny
Hi,
I was wondering if it is better/worse to have 1 SqlConnection as a
public object and initalized after i.e. the login to the application,
or to reconnect each time before some database action is needed in a
piece of code, and of course to deconnect directly after having
executed the sql-statement.
I imagine that having the connection setup at the start of the
application would consume a license on the sql-server for the life-
time of the application, where disconnecting/reconnection at each
sql-
task would limit this.
But, if licences aren't an issue, would there be other pro's/con's to
have/not have the connection setup at the start and use it for all
action within the application?
Points to considder:
- transactions
- performance
- licences
- good practice
- logging of ...
- ...
Thanks
I was wondering if it is better/worse to have 1 SqlConnection as a
public object and initalized after i.e. the login to the application,
or to reconnect each time before some database action is needed in a
piece of code, and of course to deconnect directly after having
executed the sql-statement.
I imagine that having the connection setup at the start of the
application would consume a license on the sql-server for the life-
time of the application, where disconnecting/reconnection at each
sql-
task would limit this.
But, if licences aren't an issue, would there be other pro's/con's to
have/not have the connection setup at the start and use it for all
action within the application?
Points to considder:
- transactions
- performance
- licences
- good practice
- logging of ...
- ...
Thanks