Access DB Cache?

From: Sam Kong (ssk_at_chol.net)
Date: 08/04/04


Date: 4 Aug 2004 13:42:27 -0700

Hello!

We are developing an App with VB 6.0 and Access 97.
The App accesses the DB via network.
We'd like to check the state of connection.
As you know the State property of ADODB.Connection is not live.
So we created a function (IsConnected) which sends "Select 1" to the DB.
When an error occurs the function should return false.

We tested it like the following.
1. Open the connection -> Success
2. Call IsConnected -> It returns True.
3. Unplug the network cable
4. Call IsConnected -> It still returns True.

I debugged it and surprisingly Conn.Execute "Select 1" doesn't cause an error.
I guess this problem is related to caching.

Here's the code.

-------
    If Conn.State <> adStateOpen Then
        'MsgBox ("Conn state is not open. It's obviously not connected.")
        MyIsConnected = False
        Exit Function
    End If
    DummyNum = DummyNum + 1
    sql = "select 1"
    MyIsConnected = True
    On Error GoTo MyIsConnected_Err
    Conn.Execute sql
    Exit Function
MyIsConnected_Err:
    MyIsConnected = False
    Conn.Close
------------

Anybody has an idea?

Sam



Relevant Pages

  • Re: New laptop cant connect through hub
    ... change the setting on the pc with the issue to DHCP, ... unplug the other computers from the hub. ... Ethernet adapter Local Area Connection: ... I also tried to install newer drivers for the network ...
    (microsoft.public.windowsxp.network_web)
  • RE: "Network cable is unplugged" with a twist
    ... Now go to your network connections and remove them. ... make sure that you unplug the NIC during this process and only ... > My wife and I both hook up to a linksys router. ... > unplugged" on her onboard network connection. ...
    (microsoft.public.windowsxp.hardware)
  • Re: Detect internet connetcion thru LAN
    ... The InternetGetConnectedStateis not reliable (unplug the network ... and I think the Registry look-up doesn't work for both 9x ... it does hang if no connection ...
    (microsoft.public.vb.winapi)
  • Re: Startup delay
    ... The only 'network' connection I have is my DSL modem. ... unplug to see if that does it. ... >> Right after a new install of XP Pro, I applied the Worm Blaster patch ...
    (microsoft.public.windowsxp.configuration_manage)
  • RE: Problems with Permissions
    ... And SBS server is only take ... the role of an internal server. ... they are all configured to connected to internal network. ... g. Run the Configure Email and Internet Connection Wizard on SBS server. ...
    (microsoft.public.windows.server.sbs)