Class MsAccessDataConnection
Represents a connection to MS Access database (.mdb file).
Inheritance
Inherited Members
Namespace: FastReport.Data
Assembly: FastReport.dll
Syntax
public class MsAccessDataConnection : DataConnectionBase, IComponent, IDisposable, IFRSerializable, IHasEditor, IParent
Examples
This example shows how to add a new connection to the report.
Report report1;
MsAccessDataConnection conn = new MsAccessDataConnection();
conn.DataSource = @"c:\data.mdb";
report1.Dictionary.Connections.Add(conn);
conn.CreateAllTables();
Constructors
MsAccessDataConnection()
Initializes a new instance of the MsAccessDataConnection class with default settings.
Declaration
public MsAccessDataConnection()
Fields
ProviderList
Contains supported list of providers
Declaration
public static string[] ProviderList
Field Value
Type | Description |
---|---|
System.String[] |
Properties
DataSource
Gets or sets the datasource file name.
Declaration
public string DataSource { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Password
Gets or sets the password.
Declaration
public string Password { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Provider
Gets or sets the datasource file name.
Declaration
public string Provider { get; set; }
Property Value
Type | Description |
---|---|
System.String |
UserName
Gets or sets the user name.
Declaration
public string UserName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Methods
GetAdapter(String, DbConnection, CommandParameterCollection)
Returns a System.Data.Common.DbDataAdapter object that is specific to this connection.
Declaration
public override DbDataAdapter GetAdapter(string selectCommand, DbConnection connection, CommandParameterCollection parameters)
Parameters
Type | Name | Description |
---|---|---|
System.String | selectCommand | The SQL command used to fetch a table data rows. |
System.Data.Common.DbConnection | connection | The connection object. |
CommandParameterCollection | parameters | The select command parameters. |
Returns
Type | Description |
---|---|
System.Data.Common.DbDataAdapter | The DbDataAdapter object. |
Overrides
Remarks
You should override this method if you are developing a new connection component. In this method, you need to create the adapter and set its SelectCommand's parameters.
If your connection does not use data adapter, you need to override the FastReport.Data.DataConnectionBase.FillTableSchema(System.Data.DataTable, System.String, FastReport.Data.CommandParameterCollection) and FastReport.Data.DataConnectionBase.FillTableData(System.Data.DataTable, System.String, FastReport.Data.CommandParameterCollection) methods instead.
GetConnectionId()
Gets a string that will identify a connection in the Data Wizard.
Declaration
public override string GetConnectionId()
Returns
Type | Description |
---|---|
System.String | The string that contains the connection type and some meaningful information. |
Overrides
GetConnectionStringWithLoginInfo(String, String)
Gets a connection string that contains username and password specified.
Declaration
protected override string GetConnectionStringWithLoginInfo(string userName, string password)
Parameters
Type | Name | Description |
---|---|---|
System.String | userName | User name. |
System.String | password | Password. |
Returns
Type | Description |
---|---|
System.String |
Overrides
Remarks
Override this method to pass login information to the connection. Typical implementation must get the existing ConnectionString, merge specified login information into it and return the new value.
GetConnectionType()
Returns a type of connection.
Declaration
public override Type GetConnectionType()
Returns
Type | Description |
---|---|
System.Type | Type instance. |
Overrides
Remarks
You should override this method if you developing a new connection component.
If your connection component does not use data connection, you need to override the FillTableSchema(DataTable, String, CommandParameterCollection) and FillTableData(DataTable, String, CommandParameterCollection) methods instead.
GetEditor()
Gets a control that will be used to edit the connection properties.
Declaration
public override ConnectionEditorBase GetEditor()
Returns
Type | Description |
---|---|
ConnectionEditorBase | The editor's control. |
Overrides
GetParameterType()
Gets the type of parameter that is specific to this connection.
Declaration
public override Type GetParameterType()
Returns
Type | Description |
---|---|
System.Type | The parameter's type. |
Overrides
Remarks
This property is used in the report designer to display available data types when you edit the connection parameters. For example, the type of OleDbConnection parameter is a OleDbType.
QuoteIdentifier(String, DbConnection)
Quotes the specified DB identifier such as table name or column name.
Declaration
public override string QuoteIdentifier(string value, DbConnection connection)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | Identifier to quote. |
System.Data.Common.DbConnection | connection | The opened DB connection. |
Returns
Type | Description |
---|---|
System.String | The quoted identifier. |
Overrides
SetConnectionString(String)
Sets the connection string.
Declaration
protected override void SetConnectionString(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | New connection string. |
Overrides
Remarks
Use this method if you need to perform some actions when the connection string is set.