Connection strings for Textfile

Microsoft Jet OLE DB 4.0

Type OLE DB Provider
Usage Provider=Microsoft.Jet.OLEDB.4.0
Manufacturer Microsoft

Delimited columns

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\txtFilesFolder\;
Extended Properties="text;HDR=Yes;FMT=Delimited";

The delimiter can be specified in the registry at the following location:
HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Jet \ 4.0 \ Engines \ Text
"Format" = "TabDelimited"
"Format" = "Delimited(;)"

How to Use JET in 64 bit environments »


Fixed length columns

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\txtFilesFolder\;
Extended Properties="text;HDR=Yes;FMT=Fixed";

"HDR=Yes;" indicates that the first row contains columnnames, not data. "HDR=No;" indicates the opposite.

To specify each columns length use the Schema.ini file. See description below.

Important note!
The quota " in the string needs to be escaped using your language specific escape syntax.
c#, c++   \"
VB6, VBScript   ""
xml (web.config etc)   "
or maybe use a single quota '.

More info on using the schema.ini file


.NET Framework Data Provider for OLE DB

Type .NET Framework Wrapper Class Library
Usage System.Data.OleDb.OleDbConnection
Manufacturer Microsoft

Use an OLE DB provider from .NET

Provider=any oledb provider's name;OledbKey1=someValue;OledbKey2=someValue;

See the respective OLEDB provider's connection strings options. The .net OleDbConnection will just pass on the connection string to the specified OLEDB provider. Read more here.


Microsoft Text ODBC Driver

Type ODBC Driver
Usage Driver={Microsoft Text Driver (*.txt; *.csv)}
Manufacturer Microsoft


Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=c:\txtFilesFolder\;

.NET Framework Data Provider for ODBC

Type .NET Framework Wrapper Class Library
Usage System.Data.Odbc.OdbcConnection
Manufacturer Microsoft

Use an ODBC driver from .NET

Driver={any odbc driver's name};OdbcKey1=someValue;OdbcKey2=someValue;

See the respective ODBC driver's connection strings options. The .net OdbcConnection will just pass on the connection string to the specified ODBC driver. Read more here.


.NET txtReader for Text Files

Type .NET Framework Class Library
Usage xPortTools.TxtClient.TxtConnection
Manufacturer xPortTools

Data Source='C:\MyFolder';Delimiter=',';Has Quotes=True;Skip Rows=0;Has Header=True;
Comment Prefix='';Column Type=String,String,String,Int32,Boolean,String,String;
Trim Spaces=False;Ignore Empty Lines=True;

"Comment Prefix" means that if a line in the text file starts with the provided prefix value the whole line will be treated as a comment and will not be read.