2017-11-16 2 views
0

MS Access 동시성에 대한 간단한 질문이 있습니다. 엑셀에서 입력 시트를 만들었고 VB 코드는 MS Access 데이터베이스에 대한 연결을 열어 약 5 밀리 초 안에 8 개의 필드를 기록하고 즉시 해당 사용자를 위해 연결을 닫습니다. Access에는 동시성에 대한 한계가 있지만 실제로 70 명의 사용자가 괜찮은지 알고 싶습니다. 모든 사람들이 정확히 같은 시간에 데이터를 기록하는 것은 아닙니다. 그렇게된다면, 70 명 중 20-30 명 (가장 많이)이 정확히 같은 시간에 기록 할 것이라고 말합니다.MS Access 동시 사용자

또 다른 참고로, 액세스 데이터베이스는 데이터를 저장하는 용도로만 사용됩니다.

Dim NewCon As ADODB.Connection 
    Set NewCon = New ADODB.Connection 
    Dim Recordset As ADODB.Recordset 
    Set Recordset = New ADODB.Recordset 

    NewCon.Open "Provider=Microsoft.ace.oledb.12.0;Data Source=C:\Users\my.user\Desktop\Testing\Database1.accdb" 
    Recordset.Open "DATA", NewCon, adOpenDynamic, adLockOptimistic 
    Recordset.AddNew 
    'Primary Key 
    Recordset.Fields(0).Value = G 
    'Field 2 
    Recordset.Fields(1).Value = A 
    'Field 3 
    Recordset.Fields(2).Value = B 
    'Field 4 
    Recordset.Fields(3).Value = C 
    'Field 5 
    Recordset.Fields(4).Value = D 
    'Field 6 
    Recordset.Fields(5).Value = E 
    'Field 7 
    Recordset.Fields(6).Value = F 
    'Field 8 
    Recordset.Fields(7).Value = Format(Now, "m/d/yyyy h:mm:ss") 


    Recordset.Update 
    Recordset.Close 
    NewCon.Close 
+0

SharePoint 목록을 Access에 연결하여 사용할 수 있습니까? 그렇다면 그렇게 할 것입니다. – theMayer

+0

문제가되지 않아야합니다. – June7

+0

레코드 만 추가하기 때문에 병행성에 전혀 문제가 없습니다. 업데이트가 충돌 할 가능성은 없습니다. –

답변

1

문제가되지 않습니다. 또는 오류를 포착하고 다시 시도하십시오.

심각한 문제가 발생하면, 당신은 여기에 설명 된 방법을 사용할 수 있습니다 :

전체 데모 및 코드를 포함 Handle concurrent update conflicts in Access silently

:

' Function to replace the Edit method of a DAO.Recordset. 
' To be used followed by GetUpdate to automatically handle 
' concurrent updates. 
' 
' 2016-02-06. Gustav Brock, Cactus Data ApS, CPH. 
' 
Public Sub SetEdit(ByRef rs As DAO.Recordset) 

    On Error GoTo Err_SetEdit 

    ' Attempt to set rs into edit mode. 
    Do While rs.EditMode <> dbEditInProgress 
     rs.Edit 
     If rs.EditMode = dbEditInProgress Then 
      ' rs is ready for edit. 
      Exit Do 
     End If 
    Loop 

Exit_SetEdit: 
    Exit Sub 

Err_SetEdit: 
    If DebugMode Then Debug.Print " Edit", Timer, Err.Description 
    If Err.Number = 3197 Then 
     ' Concurrent edit. 
     ' Continue in the loop. 
     ' Will normally happen ONCE only for each call of SetEdit. 
     Resume Next 
    Else 
     ' Other error, like deleted record. 
     ' Pass error handling to the calling procedure. 
     Resume Exit_SetEdit 
    End If 

End Sub 

과 :

' Function to replace the Update method of a DAO.Recordset. 
' To be used following SetEdit to automatically handle 
' concurrent updates. 
' 
' 2016-01-31. Gustav Brock, Cactus Data ApS, CPH. 
' 
Public Function GetUpdate(ByRef rs As DAO.Recordset) As Boolean 

    On Error GoTo Err_GetUpdate 

    ' Attempt to update rs and terminate edit mode. 
    rs.Update 

    GetUpdate = True 

Exit_GetUpdate: 
    Exit Function 

Err_GetUpdate: 
    If DebugMode Then Debug.Print " Update", Timer, Err.Description 
    ' Update failed. 
    ' Cancel and return False. 
    rs.CancelUpdate 
    Resume Exit_GetUpdate 

End Function 

GitHub