Access DB Cache?
From: Sam Kong (ssk_at_chol.net)
Date: 08/04/04
- Next message: Jerry Pisk: "Re: why pRecordset->put_ActiveConnection(vtMissing) does not work?"
- Previous message: Doug Stoltz: "Re: Error -2147168227 Cannot create new transaction because capacity was exceeded."
- Messages sorted by: [ date ] [ thread ]
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
- Next message: Jerry Pisk: "Re: why pRecordset->put_ActiveConnection(vtMissing) does not work?"
- Previous message: Doug Stoltz: "Re: Error -2147168227 Cannot create new transaction because capacity was exceeded."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|