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

Problems connecting?
Get answer in the Textfile Q & A forum

.NET Framework Data Provider for OLE DB

  • 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

  • Standard

    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 Framework Data Provider for ODBC

  • 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

  • Standard

    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.

Q&Aask question »

Articlesread all »

Connect

Articlesread all »

Didn't find your connection string?

Start over from the connection string reference index - or try a search!

In the Q&A forums you can ask your own question and let somebody help you.

The knowledge articles contains solutions and guides.