OleDbConnection problem

  • Thread starter Thread starter Grant
  • Start date Start date
G

Grant

My C# web application connects to an Access database using the
OleDbConnection and OleDbDataReader.
I have 3 other computers that connect to this server but very frequently I
get an 'Unspecified error' message and the site becomes unusable. I have
customErrors set to 'Off' so I can see what bit of code it is crashing at
and it is always at line 78 below. (If I try and start a debug session - the
server seems to reset itself and goes back to normal so i cant tell why its
crashing there.)

----------------------------------------------------------------------------------------------------
Line 76: OleDbConnection myDataReaderConnection = new
OleDbConnection(Constants.CONNECTION_STRING);
Line 77: OleDbCommand myDataReaderCommand = new OleDbCommand(mySelectQuery,
myDataReaderConnection);
Line 78: myDataReaderCommand.Connection.Open();
Line 79: dbReader =
myDataReaderCommand.ExecuteReader(CommandBehavior.CloseConnection);
Line 80: return dbReader;
----------------------------------------------------------------------------------------------------


I think it has something to do with the APSNET user, because when I look at
'Processes' under Task Manager and kill 'Aspnet_wp.exe' - the website is
usable again and all functionality is restored to normal.

I have tried setting the session state timeout in IIS to 3 minutes in the
hope that it will kill that process but it didnt help at all.

Does anyone know how I can resolve this?

Thanks for any help,
Grant
 
Hi,

I think it's related to concurrence accesing the DB,what if you put a
try/catch in the method you will get the exception, IIRC you will have to
check the InnerException or the NativeError , I dont remember right now the
correct one.

cheers,
 
Thanks for the reply Ignacio. The thing is I created a form application that
connects to the same database and it connects fine. When I create a
connection and check its status it is closed and I can open a new connection
with no errors and transactions work without error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top