Class OleDbConnectionDataProvider
- Namespace
- combit.Reporting.DataProviders
- Assembly
- combit.ListLabel31.CrossPlatform.OleDbConnectionDataProvider.dll
Provides a data provider for OLE DB database connections.
[Serializable]
public class OleDbConnectionDataProvider : DbConnectionDataProvider, IDataProvider, ICanHandleUsedIdentifiers, IDisposable, ISupportsLogger, ISerializable, IFileList
- Inheritance
-
OleDbConnectionDataProvider
- Implements
- Derived
- Inherited Members
Examples
The following example demonstrates how to use the OleDbConnectionDataProvider to export a report to PDF:
// Create an OLE DB connection using a provider-specific connection string.
// Example for Microsoft Access:
using OleDbConnection connection = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Data\database.accdb;");
// Create an instance of the OleDbConnectionDataProvider with a specified identifier delimiter format.
// For Access and SQL Server, use "[{0}]"; for other databases, adjust accordingly.
OleDbConnectionDataProvider provider = new OleDbConnectionDataProvider(connection, "[{0}]");
// Optional: Enable Microsoft Access SQL syntax if connecting to Access database.
// provider.UseMsAccessSqlSyntax = true;
// Create a ListLabel reporting engine instance and assign the provider as the data source.
using ListLabel listLabel = new ListLabel();
listLabel.DataSource = provider;
// Configure export settings to generate a PDF.
ExportConfiguration exportConfiguration = new ExportConfiguration(LlExportTarget.Pdf, exportFilePath, projectFilePath);
exportConfiguration.ShowResult = true;
// Export the report to PDF.
listLabel.Export(exportConfiguration);
Remarks
The OleDbConnectionDataProvider class extends DbConnectionDataProvider to provide connectivity to databases through OLE DB, a Microsoft technology for universal data access. It supports tables and views, and automatically retrieves schema information including foreign key relationships. The provider can handle various OLE DB data sources including Microsoft Access, SQL Server (via OLE DB), Oracle, and other databases with OLE DB providers. It supports customizable identifier delimiters and can detect composite keys. The provider also implements IFileList for file-based databases like Access, allowing dynamic file path updates. Special handling is included for Microsoft Access SQL syntax when needed.
Constructors
OleDbConnectionDataProvider()
Initializes a new instance of the OleDbConnectionDataProvider class.
public OleDbConnectionDataProvider()
OleDbConnectionDataProvider(OleDbConnection)
Initializes a new instance of the OleDbConnectionDataProvider class using the specified OLE DB connection.
public OleDbConnectionDataProvider(OleDbConnection connection)
Parameters
connectionOleDbConnectionThe OLE DB connection.
OleDbConnectionDataProvider(OleDbConnection, string)
Initializes a new instance of the OleDbConnectionDataProvider class using the specified OLE DB connection and identifier delimiter format.
public OleDbConnectionDataProvider(OleDbConnection connection, string identifierDelimiterFormat)
Parameters
connectionOleDbConnectionThe OLE DB connection.
identifierDelimiterFormatstringThe format for delimiting identifiers in queries.
OleDbConnectionDataProvider(SerializationInfo, StreamingContext)
Initializes a new instance of the DbConnectionDataProvider class from serialized data.
protected OleDbConnectionDataProvider(SerializationInfo info, StreamingContext context)
Parameters
infoSerializationInfoThe SerializationInfo that holds the serialized object data.
contextStreamingContextThe contextual information about the source or destination.
Properties
Connection
Gets or sets the OLE DB connection associated with this provider.
public OleDbConnection Connection { get; set; }
Property Value
IdentifierDelimiterFormat
Gets or sets the format used for delimiting identifiers in SQL queries.
public string IdentifierDelimiterFormat { get; set; }
Property Value
SupportedElementTypes
Gets or sets the supported DbConnectionElementTypes for the database connection.
public DbConnectionElementTypes SupportedElementTypes { get; set; }
Property Value
Remarks
This property indicates which element types (tables, views) are supported by this data provider.
SupportsAdvancedFiltering
Gets or sets a value indicating whether advanced filtering is supported by the data provider.
public override sealed bool SupportsAdvancedFiltering { get; set; }
Property Value
Methods
Init()
Initializes the data provider by retrieving database schema information.
protected override void Init()