Retrieving SQL Connection Data
In Microsoft Excel, connect to a database by:
- Clicking the Data menu and selecting From Other Sources followed by From SQL Server.
- Then select Data followed by Connections.
- Use the Connections wizard to connect to the database and create a database query.
Aspose.Cells provides the Workbook.DataConnections property for retrieving external connections. It returns a collection of ExternalConnection objects in the workbook.
If the ExternalConnection object contains SQL connection data, it can be type-caste to a DBConnection object and its properties can be used to retrieve database command, command type, connection description, connection information, credentials, and so on.