数据库连接代码更改一下,原来我测试过在局域网是可以的,前提每个电脑要能测试连接到这个安装了SQL的数据库电脑
Dim mycon As ADODB.Connection
Dim rst As ADODB.Recordset
Set mycon = New ADODB.Connection
mycon.ConnectionString = "
Provider=sqloledb;server=192.168.1.1;Database=sxcpmc;Uid=sa;Pwd=;"
mycon.Open
Dim stokens() As String
On Error GoTo exectuesql_error
stokens = Split(sql)
If InStr("INSER,DELETE,UPDATE", UCase(stokens(0))) Then
mycon.Execute sql
Else
Set rst = New ADODB.Recordset
rst.Open Trim(sql), mycon, adOpenKeyset, adLockOptimistic
Set ExecuteSQL = rst
End If