|
例子,希望能对你有所帮助
Sub Main
Dim errors(1 To 3, 1 To 10) As Variant
Dim outputStr As String
Dim connection As Long
Dim prompt As Integer
Dim connect_str as string
Dim retcode as long
connection = -1
connect_str = "DSN=TestData;DBQ=C:\SQATemplates\testdata.mdb;"
connection = SQLOpen(connect_str, outputStr, prompt:=3)
if connection < 0 then
SQLError destination:=errors
Msgbox "The SQLOpen was in unsuccessful due to error. connection= "&CStr(connection)&" Description= "&CStr(errors(1,3))
Exit Sub
end if
retcode = SQLClose(connection)
MsgBox "Your connect string is: "&Cstr(outputStr)
stop
End Sub |
|