ADO.NET Provider for Microsoft Excel

Build 23.0.8839

Connection Properties

You can programmatically access the information about the available connection properties and those set in the connection string by querying the ConnectionProperties schema collection.

Retrieving Connection Property Information

To retrieve the ConnectionProperties schema collection, call the GetSchema method of the ExcelConnection class. Access the results in the DataTable returned.

C#

DbProviderFactory provider = DbProviderFactories.GetFactory("System.Data.CData.Excel");
using(DbConnection conn = provider.CreateConnection()) {
  conn.Open();
  DataTable databaseSchema = conn.GetSchema("ConnectionProperties");
  foreach (DataRow row in databaseSchema.Rows) {
    Console.WriteLine(row["Name"]);
    Console.WriteLine(row["Type"]);
    Console.WriteLine(row["ShortDescription"]);
  }
} 

VB.NET

Dim provider = DbProviderFactories.GetFactory("System.Data.CData.Excel")
Using conn As DbConnection = provider.CreateConnection()
  conn.Open()
  Dim databaseSchema As DataTable = conn.GetSchema("ConnectionProperties")
    For Each row As DataRow In databaseSchema.Rows
    Console.WriteLine(row("Name"))
    Console.WriteLine(row("Type"))
    Console.WriteLine(row("ShortDescription"))
  Next
End Using

Columns Returned

The ConnectionProperties schema collection contains the following information:

Column NameData TypeDescription
NameSystem.StringThe name of the connection property.
ShortDescriptionSystem.StringA description of the connection property.
TypeSystem.StringThe data type.
ValuesSystem.StringThe allowed values.
DefaultSystem.StringThe default value if one is not set by the user.
CategorySystem.StringA category grouping associated connection properties.
RequiredSystem.StringWhether the property is required to connect.
ValueSystem.StringThe current value of the connection property.

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 23.0.8839