Class CsvDataConnection
Represents a connection to csv file-based database.
Inheritance
System.Object
CsvDataConnection
Assembly: FastReport.Base.dll
Syntax
public class CsvDataConnection : DataConnectionBase, IDisposable, IFRSerializable, IParent
Examples
This example shows how to add a new connection to the report.
Report report1;
CsvDataConnection conn = new CsvDataConnection();
conn.CsvFile = @"c:\data.csv";
report1.Dictionary.Connections.Add(conn);
conn.CreateAllTables();
Constructors
CsvDataConnection()
Declaration
public CsvDataConnection()
Properties
Codepage
Gets or sets the codepage of the .csv file.
Declaration
public int Codepage { get; set; }
Property Value
Type |
Description |
System.Int32 |
|
ConvertFieldTypes
Gets or sets the value indicating that field types fhould be converted.
Declaration
public bool ConvertFieldTypes { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
CsvFile
Gets or sets the path to .csv file.
Declaration
public string CsvFile { get; set; }
Property Value
Type |
Description |
System.String |
|
Gets or sets locale name used to auto-convert currency fields, e.g. "en-US".
Declaration
public string CurrencyFormat { get; set; }
Property Value
Type |
Description |
System.String |
|
Gets or sets locale name used to auto-convert datetime fields, e.g. "en-US".
Declaration
public string DateTimeFormat { get; set; }
Property Value
Type |
Description |
System.String |
|
FieldNamesInFirstString
Gets or sets the value indicating that field names should be loaded from the first string of the file.
Declaration
public bool FieldNamesInFirstString { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
Gets or sets locale name used to auto-convert numeric fields, e.g. "en-US".
Declaration
public string NumberFormat { get; set; }
Property Value
Type |
Description |
System.String |
|
RemoveQuotationMarks
Gets or sets the value indicating that quotation marks should be removed.
Declaration
public bool RemoveQuotationMarks { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
Separator
Gets or sets the separator of the .csv file.
Declaration
public string Separator { get; set; }
Property Value
Type |
Description |
System.String |
|
Methods
CreateDataSet()
Declaration
protected override DataSet CreateDataSet()
Returns
Overrides
CreateDataSetAsync(CancellationToken)
Declaration
protected override async Task<DataSet> CreateDataSetAsync(CancellationToken cancellationToken)
Parameters
Type |
Name |
Description |
System.Threading.CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
System.Threading.Tasks.Task<DataSet> |
|
Overrides
CreateTable(TableDataSource)
Declaration
public override void CreateTable(TableDataSource source)
Parameters
Overrides
CreateTableAsync(TableDataSource, CancellationToken)
Declaration
public override async Task CreateTableAsync(TableDataSource source, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type |
Name |
Description |
TableDataSource |
source |
|
System.Threading.CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Overrides
DeleteTable(TableDataSource)
Declaration
public override void DeleteTable(TableDataSource source)
Parameters
Overrides
FillTableData(DataTable, String, CommandParameterCollection)
Declaration
public override void FillTableData(DataTable table, string selectCommand, CommandParameterCollection parameters)
Parameters
Overrides
FillTableDataAsync(DataTable, String, CommandParameterCollection, CancellationToken)
Declaration
public override Task FillTableDataAsync(DataTable table, string selectCommand, CommandParameterCollection parameters, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type |
Name |
Description |
DataTable |
table |
|
System.String |
selectCommand |
|
CommandParameterCollection |
parameters |
|
System.Threading.CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Overrides
FillTableSchema(DataTable, String, CommandParameterCollection)
Declaration
public override void FillTableSchema(DataTable table, string selectCommand, CommandParameterCollection parameters)
Parameters
Overrides
FillTableSchemaAsync(DataTable, String, CommandParameterCollection, CancellationToken)
Declaration
public override Task FillTableSchemaAsync(DataTable table, string selectCommand, CommandParameterCollection parameters, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type |
Name |
Description |
DataTable |
table |
|
System.String |
selectCommand |
|
CommandParameterCollection |
parameters |
|
System.Threading.CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Overrides
GetTableNames()
Declaration
public override string[] GetTableNames()
Returns
Type |
Description |
System.String[] |
|
Overrides
GetTableNamesAsync(CancellationToken)
Declaration
public override Task<string[]> GetTableNamesAsync(CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type |
Name |
Description |
System.Threading.CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
System.Threading.Tasks.Task<System.String[]> |
|
Overrides
QuoteIdentifier(String, DbConnection)
Declaration
public override string QuoteIdentifier(string value, DbConnection connection)
Parameters
Type |
Name |
Description |
System.String |
value |
|
DbConnection |
connection |
|
Returns
Type |
Description |
System.String |
|
Overrides
Checking a relative path relative to a file
Declaration
protected void RelatedPathCheck(CsvConnectionStringBuilder builder)
Parameters
SetConnectionString(String)
Declaration
protected override void SetConnectionString(string value)
Parameters
Type |
Name |
Description |
System.String |
value |
|
Overrides
Implements