Public Function ExecuteSQL(ByVal sql As String) As ADODB.Recordset
Dim rst As ADODB.Recordset
Dim stokens() As String
'On Error GoTo exectuesql_error
stokens = Split(sql)
Set rst = New ADODB.Recordset
Set ExecuteSQL = New ADODB.Recordset
If InStr("INSERT,DELETE,UPDATE", UCase$(stokens(0))) Then
mycon.Execute sql
Else
rst.Open Trim$(sql), mycon, adOpenKeyset, adLockOptimistic
Set ExecuteSQL = rst
End If
exectuesql_exit:
Set rst = Nothing
Set mycon = Nothing
Exit Function
exectuesql_error:
Resume exectuesql_exit
End Function
为什么老是出现 rst.Open Trim$(sql), mycon, adOpenKeyset, adLockOptimistic错误啊
我用的是ACCESS数据库,MYCON是是数据库链接用的相对路径
加我QQ也行,78075493