Click here to Skip to main content
14,331,612 members
Rate this:
Please Sign up or sign in to vote.
See more: , +
I have a problem with two add pages. They work for about 2 to 3 minutes then I get this error message Unable to connect to database. Please contact your Administrator.
c# is the code.
SQL Server 2008 is the database.
Was thinking that is was session was timing out but it set to 2hrs in the web config file.
This is only happening with one user and their two pages Add and edit.
Every other page is working fine with other users.
Here are thing I have tried:
rebuilt the pages four times.
rebuilt the database.
rebuilt the user account
change user permission to admin
change the session timeout to 3hrs.
change user computer.
It's only this user.
I log in and tested and inserted data for 15 minutes no problem.
any ideas.

Also if I stop and restart IIS the page begin to allow input for 2 minutes then breaks
Sandeep Mewara 31-Mar-11 10:39am
It's a connection timeout issue. What to you looks like working for 2-3 min is actually the time when connection is configured to try and connect. Once the limit is crossed, it fails.

Look at the reason of it's failure. There must be some stack trace on page or in event viewer. The user in question looks like having short of access priviledge.

Without exact error, it is hard to comment more.
postonoh 5-Apr-11 12:31pm
Here is some additional information. When I test it with VS2008 on local and on the test server it works fine. no problem.
Rate this:
Please Sign up or sign in to vote.

Solution 1

Looks like you have a loop (for or while) in your code that never finishes/breaks, to check if that is the case before you restart IIS, check the memory usage and cpu of IIS and the database, that will tell you everything.
After you confirm it, fix the loop
postonoh 1-Apr-11 14:01pm
I have no clue how to do this. but I will look in my code for the loop problem.
postonoh 7-Apr-11 12:50pm
Thanks, I check my upload code where the if / else statement. I commented them out and the code working know. I have to find a easier way to do multiple uploads.
Rate this:
Please Sign up or sign in to vote.

Solution 2

Does the user need/have an account on the server in question (not in sql, but on the box itself)?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100