Textfile connection strings

Microsoft Jet OLE DB 4.0

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

Microsoft Text ODBC Driver


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

64 bit

Driver=Microsoft Access Text Driver (*.txt, *.csv);Dbq=c:\txtFilesFolder\; Extensions=asc,csv,tab,txt;

64-bit ODBC drivers from Microsoft Access Database Engine 2010 64-bit Redistributable have changed driver names

.NET txtReader for Text Files


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

"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.