<div class="meta" robots="noindex">

</div>

Method

# ODBCDatabase.DataSourceNames

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2020r2. Please use `ODBCDatabase.DataSources<odbcdatabase.datasources>` as a replacement.

</div>

## Description

Returns a `RowSet</api/databases/rowset>` with a list of configured Data Source Names (DSN). Returns both User and System DSNs in a single `RowSet</api/databases/rowset>`.

## Notes

The instance of the ODBCDatabase does not have to be connected to a database in order to use this method.

The `RowSet</api/databases/rowset>` returned by <span class="title-ref">DataSourceNames</span> has two columns. They are:

- Name: The data source name
- Description: The Name of the ODBC driver.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### References

[SQLDataSources ODBC function](http://msdn.microsoft.com/en-us/library/windows/desktop/ms711004(v=vs.85).aspx)

## Sample code

This code gets all the ODBC data source names and adds them to a ListBox:

``` xojo
DataSourceList.DeleteAllRows

Dim db As New ODBCDatabase

Dim rs As RecordSet
rs = db.DataSourceNames

If rs <> Nil Then
  While Not rs.EOF
    DataSourceList.AddRow(rs.Field("Name").StringValue, rs.Field("Description").StringValue)
    rs.MoveNext
  Wend
  rs.Close
End If
```

## Compatibility

All project types on all supported operating systems.
