sql connection errors as usage increases
From: kkres (kkres_at_discussions.microsoft.com)
Date: 08/24/04
- Next message: Claude G (Frac: "Update Data using a DataGrid"
- Previous message: Marie-Eve Racicot: "E_OUTOFMEMORY when opening recordset in IIS"
- Next in thread: William \(Bill\) Vaughn: "Re: sql connection errors as usage increases"
- Reply: William \(Bill\) Vaughn: "Re: sql connection errors as usage increases"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 24 Aug 2004 12:21:11 -0700
I own an ASP .NET application that uses ADO.NET to manage SQLConnections to a
SQL Srvr 2000 database. Until recently the app has been working fine
(with a very small number of users). But in recent weeks number of users has
dramatically increased, and now the site is reporting this frequent error:
System.InvalidOperationException: Not allowed to change the
'ConnectionString'
property while the connection (state=Open). at
System.Data.SqlClient.SqlConnection.set_ConnectionString(Stringvalue)
at ... in ...basApplication.vb:line 89
It occurs as the user login and the app is creating 2 connections strings
for use during the user's session. The code in question is essentially:
Public gobjConn As New
SqlClient.SqlConnection(ConfigurationSettings.AppSettings("dsn"))
Public gobjConn2 As New
SqlClient.SqlConnection(ConfigurationSettings.AppSettings("dsn"))
-
-
gobjConn.Close()
gobjConn2.Close()
-
-
gobjConn.ConnectionString = strDataSource & strDataBase & "UID=fred;" &
"PWD=xyz;"
gobjConn2.ConnectionString = strDataSource & strDataBase & "UID=fred;" &
"PWD=xyz;" (line 89)
gobjConn.Open()
gobjConn2.Open()
The connection strings are identical (same server and db) and exactly the
same (same login and pw) for all users.
I had thought that the Close operations before the Opens would always assure
that no connection would ever be left open.
This site has been able to live with the problem by regularly restarting IIS.
What am I missing?
Thanks,
-- kkres
- Next message: Claude G (Frac: "Update Data using a DataGrid"
- Previous message: Marie-Eve Racicot: "E_OUTOFMEMORY when opening recordset in IIS"
- Next in thread: William \(Bill\) Vaughn: "Re: sql connection errors as usage increases"
- Reply: William \(Bill\) Vaughn: "Re: sql connection errors as usage increases"
- Messages sorted by: [ date ] [ thread ]