ADO Connection Problem and Windows 2000 - multiuser problem

ADO Connection Problem and Windows 2000 - multiuser problem

Post by Noel Carne » Wed, 29 Mar 2000 04:00:00



I am trying to connect to an Access 2 jet data base ( see below)

*************************************************
  Set cnnJtables = New ADODB.Connection
  strProvider = "Microsoft.Jet.OLEDB.4.0"

 With cnnJtables

      .Provider = strProvider
      .Properties("Jet OLEDB:System DataBase") = strWHSystem
      .Open strJTables & "\Jtables.mdb", strUsr, strPW

 End With
****************************************************

If  the tables (Jtables.mdb) are currently in use (ie open by another
application )
then the connection fails with error number 2147467259 - 'file already in
use'.
The code works fine if the other application is not active. It also runs
fine with
win 98 and NT4. I have checked the
security levels for the file in question (jtables.mdb) and all seems ok -
full access with system previlidges. Does anyone have any ideas. Thanks

noel

 
 
 

ADO Connection Problem and Windows 2000 - multiuser problem

Post by Thorsten Schemb » Wed, 29 Mar 2000 04:00:00


perhaps you'll try it with:

with cnnJTables
    .Mode = adModeShareDenyNone + adModeReadWrite
'Your code

Thorsten



Quote:> I am trying to connect to an Access 2 jet data base ( see below)

> *************************************************
>   Set cnnJtables = New ADODB.Connection
>   strProvider = "Microsoft.Jet.OLEDB.4.0"

>  With cnnJtables

>       .Provider = strProvider
>       .Properties("Jet OLEDB:System DataBase") = strWHSystem
>       .Open strJTables & "\Jtables.mdb", strUsr, strPW

>  End With
> ****************************************************

> If  the tables (Jtables.mdb) are currently in use (ie open by another
> application )
> then the connection fails with error number 2147467259 - 'file already in
> use'.
> The code works fine if the other application is not active. It also runs
> fine with
> win 98 and NT4. I have checked the
> security levels for the file in question (jtables.mdb) and all seems ok -
> full access with system previlidges. Does anyone have any ideas. Thanks

> noel


 
 
 

1. Multiuser Access 2000 DB using ADO - Locking Problem

I have developed a Access 2000 client using Visual Basic 6.0 and ADO 2.1
which is running 6 instances on 6 different machines. The code polls the DB
every 2 seconds with a complex SELECT query but intermittantly reports the
following error:

ERROR : The database has been placed in a state by user 'ADMIN' on machine
'TEST_CLIENT' that prevents it from being opened or locked.

I can't understand why since I'm using adOpenForwardOnly and
adLockReadOnly...

Can anyone please tell me if I not ding things correctly to open the
database in shared mode?

Thanks for any help in advance!

Marcus

Here an example (not real) of how the function is called:

Function ExampleSelect(pMeetingID As Long)

    Dim Rs As New ADODB.Recordset

    If fDBLibOpenRsDisconnected("SELECT * FROM tblMeetings WHERE
(([MeetingID]=" & pMeetingID & "));", Rs) = True Then
        Debug.Print "Worked Fine"
    Else
        Debug.Print "Error"
    End If

    Rs.Close
    Set Rs = Nothing

End Function

Here is the real function:

Public Function fDBLibOpenRsDisconnected(strCmd As String, pRs As
ADODB.Recordset) As Boolean

On Error GoTo Err_fDBLibOpenRsDisconnected

    Dim pCnn As ADODB.Connection
    Set pCnn = New ADODB.Connection

    fDBLibOpenRsDisconnected = True

    pCnn.CommandTimeout = 60

    pCnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Jet
OLEDB:Database Password=sunshine;Data Source=T:\database.mdb;Persist
Security Info=False"

    pRs.CursorLocation = adUseClient
    pRs.Open strCmd, pCnn, adOpenForwardOnly, adLockReadOnly

    pRs.ActiveConnection = Nothing

Exit_fDBLibOpenRsDisconnected:

    If pCnn.State = adStateOpen Then pCnn.Close
    Set pCnn = Nothing

    Exit Function

Err_fDBLibOpenRsDisconnected:

    Dim colErrors As ADODB.Errors
    Dim objError As ADODB.Error

    Set colErrors = pCnn.Errors

    If pRs.State = adStateOpen Then pRs.Close

    fDBLibOpenRsDisconnected = False

    If gblErrorMsg = True Then
        For Each objError In colErrors
            MsgBox objError.Description, vbCritical, "ADO Error in
fDBLibOpenRsDisconnected"
        Next
        fDisplayError "fDBLibOpenRsDisconnected"
    End If

    Resume Exit_fDBLibOpenRsDisconnected

End Function

2. winsock control and VFP5.0

3. sql 2000 iis 5 ado database connection problem -- connections slow

4. DB2 WM. Warehouse Manager edition, Desperately need help with this

5. SQL Server 7.0 Connection Problems (Windows 2000)

6. Temp dbspaces in RAM

7. SQL 7.0 desktop connection problem on windows 2000 prof

8. ADO Connect Problem in Windows 2000 Operating System

9. ADO.NET - SQL 2000 connection problem

10. Multiuser-problem (SQL Server 2000)

11. chinese Character problem on Oracle, windows 98 and windows 2000

12. Upgraded to Windows 2000 from 98SE, ADO connection failure