Why does ADO.NET behave oddly during network outage?

  • Thread starter Thread starter davepkz
  • Start date Start date
D

davepkz

Hi,
I have a C# Windows app that uses ADO.NET.

I place an Access db on a network drive and connect to it with my app.
Then I pull the network cable.
Under some conditions (I haven't been able to isolate the pattern), I
can continue to make database requests (e.g. "SELECT COUNT(*) OF
EMPLOYEE" returns 285)... and get no errors!

Why? Shouldn't it throw an exception saying "Drive or Network not
found" ??
Has it cached the whole database? (I would rather it not).

THEN...
I reconnect the network cable. And I wait a good 30 seconds to be
sure all connections are active.
Under some conditions (still can't find the pattern), I do get the
exception I was expecting before: Network Error Native ErrorCode =
-66913278.

Why would I get any error when connection is back and active? If I
Close() and Open() the OleDbConnection object, all is happy again.
I'm just not clear why that should be necessary (It wasn't back in the
ODBC days...)

Does anyone understand why ADO.NET behaves this way?
Thanks
Dave
 
Because JET caches data in memory until it decides to commit the changes to
the disk (via the network). Frankly (IMHO) using JET over a network is...
dangerous--you're just asking for trouble.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
 
Back
Top