|
后台数据表在局域网上电脑A,如果在前台程序中加入以下语句,会有两种结果:
1、在电脑A上运行,正常。2、在其他电脑上运行,程序死掉,要强行结束。这是为何?
Public Function InputUserIp(IpStr As String, NameStr As String) As Boolean
Dim Rst As ADODB.Recordset
Dim Cnn As ADODB.Connection
Set Rst = New ADODB.Recordset
Set Cnn = CurrentProject.Connection
Rst.Open "用户IP", Cnn, adOpenDynamic, adLockPessimistic
With Rst
Do While Not .EOF
If ![IPADDRESS] = IpStr Then
!PCNAME = NameStr
!LOGINTIME = Now()
.Update
InputUserIp = True
Exit Do
End If
Loop
If Not InputUserIp Then
.AddNew
!IPADDRESS = IpStr
!PCNAME = NameStr
!LOGINTIME = Now()
.Update
InputUserIp = True
End If
.Close
End With
Set Cnn = Nothing
Set Rst = Nothing
End Function
|
|