1 對話框永遠出現
2 說明不夠充分以建立連接時打開驅動對話框
3 同2,對話框內容為灰色,不能修改
4 對話框不出現,連接不成功,則返回一個錯誤
注解:
關于connectStr的內容描述在ODBC微軟程序員參考手冊。典型字符串形式為"DSN=datasourcename; UID=myid; PWD=mypassword"。返回長型long型。
當prompt缺省時,SQLOpen使用2作為默認值。 SQLOpen Example
This example opens the data source named "SblTest," gets the names in the ODBC data sources, and closes the connection.
Sub main
'' Declarations
Dim outputStr As String
Dim connection As Long
Dim prompt As Integer
Dim datasources(1 To 50) As Variant
Dim retcode As Variant
Dim action1 as Integer
Dim qualifier as String
prompt = 5
'' Open the datasource "SblTest"
connection = SQLOpen("DSN=SblTest", outputStr, prompt:=5)
action1 = 1 '' Get the names of the ODBC datasources
retcode = SQLGetSchema(connection:=connection,action:=1, qualifier:=qualifier, ref:=datasources())
'' Close the datasource connection
retcode = SQLClose(connection)
End Sub
文章來源于領測軟件測試網 http://www.kjueaiud.com/