Show / Hide Table of Contents

Class CsvDataConnection

Represents a connection to csv file-based database.

Inheritance
System.Object
Base
DataComponentBase
DataConnectionBase
CsvDataConnection
Implements
IFRSerializable
IParent
Inherited Members
DataConnectionBase.DataSet
DataConnectionBase.Tables
DataConnectionBase.ConnectionString
DataConnectionBase.ConnectionStringExpression
DataConnectionBase.IsSqlBased
DataConnectionBase.LoginPrompt
DataConnectionBase.CommandTimeout
DataConnectionBase.Dispose(Boolean)
DataConnectionBase.DisposeDataSet()
DataConnectionBase.GetConnectionStringWithLoginInfo(String, String)
DataConnectionBase.CanContain(Base)
DataConnectionBase.GetChildObjects(ObjectCollection)
DataConnectionBase.AddChild(Base)
DataConnectionBase.RemoveChild(Base)
DataConnectionBase.GetChildOrder(Base)
DataConnectionBase.SetChildOrder(Base, Int32)
DataConnectionBase.UpdateLayout(Single, Single)
DataConnectionBase.CreateAllTables()
DataConnectionBase.CreateAllTables(Boolean)
DataConnectionBase.CreateRelations()
DataConnectionBase.GetTableNames()
DataConnectionBase.GetConnectionType()
DataConnectionBase.GetConnection()
DataConnectionBase.OpenConnection(DbConnection)
DataConnectionBase.DisposeConnection(DbConnection)
DataConnectionBase.GetAdapter(String, DbConnection, CommandParameterCollection)
DataConnectionBase.GetParameterType()
DataConnectionBase.Serialize(FRWriter)
DataConnectionBase.GetExpressions()
DataComponentBase.Alias
DataComponentBase.Enabled
DataComponentBase.ReferenceName
DataComponentBase.Reference
DataComponentBase.IsAliased
DataComponentBase.Assign(Base)
DataComponentBase.SetName(String)
DataComponentBase.InitializeComponent()
Base.Name
Base.Restrictions
Base.Flags
Base.Parent
Base.BaseName
Base.ClassName
Base.Report
Base.Page
Base.ChildObjects
Base.AllObjects
Base.ZOrder
Base.IsAncestor
Base.IsDesigning
Base.IsPrinting
Base.IsRunning
Base.OriginalComponent
Base.SetProp(Base, Base)
Base.FloatDiff(Single, Single)
Base.DeserializeSubItems(FRReader)
Base.ExtractDefaultMacros(String)
Base.SetFlags(Flags, Boolean)
Base.SetReport(Report)
Base.SetParent(Base)
Base.SetParentCore(Base)
Base.FindObject(String)
Base.CreateUniqueName()
Base.Clear()
Base.Deserialize(FRReader)
Base.BaseAssign(Base)
Base.AssignAll(Base)
Base.HasParent(Base)
Base.HasFlag(Flags)
Base.HasRestriction(Restrictions)
Base.InvokeEvent(String, Object)
Base.OnAfterLoad()
Base.GetCustomScript()
Base.ExtractMacros()
Base.IsHaveToConvert(Object)
Base.GetConvertedObjects()
Base.ForEachAllConvectedObjects(Object)
Namespace: FastReport.Data
Assembly: FastReport.OpenSource.dll
Syntax
public class CsvDataConnection : DataConnectionBase, 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()

Initializes a new instance of the CsvDataConnection class.

Declaration
public CsvDataConnection()

Fields

DEFAULT_FIELD_NAME

The default field name.

Declaration
public const string DEFAULT_FIELD_NAME = "Field"
Field Value
Type Description
System.String

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

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

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()

Initializes a DataSet instance.

Declaration
protected override DataSet CreateDataSet()
Returns
Type Description
DataSet

The DataSet object.

Overrides
DataConnectionBase.CreateDataSet()
Remarks

This method is used to support FastReport infrastructure. You don't need to use it.

CreateTable(TableDataSource)

Creates table. For internal use only.

Declaration
public override void CreateTable(TableDataSource source)
Parameters
Type Name Description
TableDataSource source
Overrides
DataConnectionBase.CreateTable(TableDataSource)

DeleteTable(TableDataSource)

Deletes table. For internal use only.

Declaration
public override void DeleteTable(TableDataSource source)
Parameters
Type Name Description
TableDataSource source
Overrides
DataConnectionBase.DeleteTable(TableDataSource)

FillTableData(DataTable, String, CommandParameterCollection)

Fills the table data.

Declaration
public override void FillTableData(DataTable table, string selectCommand, CommandParameterCollection parameters)
Parameters
Type Name Description
DataTable table

DataTable to fill.

System.String selectCommand

The SQL select command.

CommandParameterCollection parameters

SQL parameters.

Overrides
DataConnectionBase.FillTableData(DataTable, String, CommandParameterCollection)
Remarks

Usually you don't need to use this method. Internally it uses the GetConnection() and GetAdapter(String, DbConnection, CommandParameterCollection) methods to fill the table data. If you create own connection component that does not use nor connection or adapter, then you need to override this method.

FillTableSchema(DataTable, String, CommandParameterCollection)

Fills the table schema.

Declaration
public override void FillTableSchema(DataTable table, string selectCommand, CommandParameterCollection parameters)
Parameters
Type Name Description
DataTable table

DataTable to fill.

System.String selectCommand

The SQL select command.

CommandParameterCollection parameters

SQL parameters.

Overrides
DataConnectionBase.FillTableSchema(DataTable, String, CommandParameterCollection)
Remarks

Usually you don't need to use this method. Internally it uses the GetConnection() and GetAdapter(String, DbConnection, CommandParameterCollection) methods to fill the table schema. If you create own connection component that does not use nor connection or adapter, then you need to override this method.

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.

DbConnection connection

The opened DB connection.

Returns
Type Description
System.String

The quoted identifier.

Overrides
DataConnectionBase.QuoteIdentifier(String, DbConnection)

SetConnectionString(String)

Sets the connection string.

Declaration
protected override void SetConnectionString(string value)
Parameters
Type Name Description
System.String value

New connection string.

Overrides
DataConnectionBase.SetConnectionString(String)
Remarks

Use this method if you need to perform some actions when the connection string is set.

Implements

IFRSerializable
IParent
Back to top Generated by DocFX