DBConnection.ConnectionInfo
DBConnection.ConnectionInfo property
The connection information string is used to make contact with an OLE DB or ODBC data source.
[Obsolete("Use ExternalConnection.ConnectionString property instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public string ConnectionInfo { get; set; }
Remarks
NOTE: This property is now obsolete. Instead, please use ExternalConnection.ConnectionString property. This method will be removed 12 months later since October 2024. Aspose apologizes for any inconvenience you may have experienced.
Examples
namespace AsposeCellsExamples
{
using Aspose.Cells;
using Aspose.Cells.ExternalConnections;
using System;
public class DBConnectionPropertyConnectionInfoDemo
{
public static void Run()
{
// Create a new workbook
Workbook workbook = new Workbook();
try
{
// Create a new DBConnection instance by adding it to the collection
var connections = workbook.DataConnections;
DBConnection dbConnection = (DBConnection)connections[connections.Count];
// Set up a basic connection to demonstrate the ConnectionInfo property
dbConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\data\\database.mdb;";
dbConnection.CommandType = OLEDBCommandType.TableName;
dbConnection.Command = "Customers";
// Display the current value of the ConnectionInfo property
Console.WriteLine("Current ConnectionInfo value: " + dbConnection.ConnectionInfo);
// Since ConnectionInfo is not read-only, demonstrate setting it
dbConnection.ConnectionInfo = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\data\\database.mdb;";
Console.WriteLine("Updated ConnectionInfo value: " + dbConnection.ConnectionInfo);
// Save the workbook
workbook.Save("ConnectionInfoDemo.xlsx");
Console.WriteLine("ConnectionInfo demonstration completed successfully.");
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
}
}
}
See Also
- class DBConnection
- namespace Aspose.Cells.ExternalConnections
- assembly Aspose.Cells