G
Guest
Hi,
I am working on a C# .net 1.1 project in which there is a search box. As
the user types, it refreshes the results list based on LIKE %% query to an
MSDE database (in this case on the local machine). Initially, I implemented
it with a single-threaded, but eventually for performance reasons I decided
to add in a seperate worker thread to perform the actual search. So if a
user types a character while the worker thread is still running, I call
Abort() on the thread. The function that the worker thread catches the abort
exception and closes the OdbcConnection database connection. It then starts
a new thread. This allows the user to type quickly without having to wait
for all of the results to be displayed.
So the wierdness that I am running into only happens if the user types
quickly (presumably resulting in a lot of thread terminations/restarts).
After about 20 rapid keystrokes, the OdbcConnection will fail to connect to
the MSDE 2000 database and return the following error:
[2800][Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user
'sa'
Any subsequent keystrokes will cause this same error, regardless of how long
I let it sit. The only way to get it working again is to close and re-open
the whole application. What's going on here? I'm pretty sure I'm cleaning
up all of my OdbcConnections and closing the OdbcDataReader. I also tried
using SqlClient instead of Odbc and I get the same thing. I am not using a
trusted connection.
Any ideas?
Thanks,
Andrew Bragdon
I am working on a C# .net 1.1 project in which there is a search box. As
the user types, it refreshes the results list based on LIKE %% query to an
MSDE database (in this case on the local machine). Initially, I implemented
it with a single-threaded, but eventually for performance reasons I decided
to add in a seperate worker thread to perform the actual search. So if a
user types a character while the worker thread is still running, I call
Abort() on the thread. The function that the worker thread catches the abort
exception and closes the OdbcConnection database connection. It then starts
a new thread. This allows the user to type quickly without having to wait
for all of the results to be displayed.
So the wierdness that I am running into only happens if the user types
quickly (presumably resulting in a lot of thread terminations/restarts).
After about 20 rapid keystrokes, the OdbcConnection will fail to connect to
the MSDE 2000 database and return the following error:
[2800][Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user
'sa'
Any subsequent keystrokes will cause this same error, regardless of how long
I let it sit. The only way to get it working again is to close and re-open
the whole application. What's going on here? I'm pretty sure I'm cleaning
up all of my OdbcConnections and closing the OdbcDataReader. I also tried
using SqlClient instead of Odbc and I get the same thing. I am not using a
trusted connection.
Any ideas?
Thanks,
Andrew Bragdon