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
文章来源于领测软件测试网 https://www.ltesting.net/