Examples: DataSourceName property

The following agent uses DataSourceName to display the name of a data source once you are connected.

Uselsx "*LSXODBC"
Sub Initialize
  Dim con As New ODBCConnection
  Dim dsn As String
  Dim msg As String
  dsn = Inputbox("ODBC data source name", "DSN")
  If Not con.ConnectTo(dsn) Then
    Messagebox "Could not connect to " & dsn,, "Error"
    Exit Sub
  End If
  Messagebox "You successfully connected to " &  _
  con.DataSourceName,, _
  "Connected to " & con.DataSourceName
  con.Disconnect
End Sub