Examples: IsConnected method
The following button checks first to see if a connection already exists, and then connects to a user-specified data source:
Uselsx "*LSXODBC"
Dim con As ODBCConnection
Sub Postopen(Source As Notesuidocument)
Set con = New ODBCConnection
End Sub
Sub Click(Source As Button)
Dim dataSource As String
If con.IsConnected Then
Messagebox "Already connected to " & _
con.DataSourceName
Exit Sub
End If
dataSource = Inputbox$("Enter name of data source", _
"Data source?")
If Not con.ConnectTo(dataSource) Then
Messagebox "Could not connect to " & dataSource
End If
End Sub
Sub Queryclose(Source As NotesUIDocument, Continue As Variant)
con.Disconnect
End Sub