R
Rich
I need to read a large space delimted text file. I can do this using a
streamReader except it takes twice as long as an OleDBDataAdapter (using the
following delimiters: tabDelimited/comma/| pipe). My problem is in using a
space as the delimiter for reading a space delimited text file using OleDB.
Here are some sample connection strings for a tabDelimited text file or Pipe
Delimited (which both work fine):
string s1 = Application.StartupPath;
connOle.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
+ s1 + ";Extended Properties=\"text;HDR=Yes;FMT=TabDelimited\"";
connOle.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
+ s1 + ";Extended Properties=\"text;HDR=Yes;FMT=Delimited(|)\""
Note: oleDB also requires a schema.ini file to be placed in the same folder
as the text file to be read
save as schema.ini
[fileName.extention]
ColNameHeader=true
CharacterSet=ANSI
Format=Delimited(|)
I have tried variations for space delimiting without success
connOle.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
+ s1 + ";Extended Properties=\"text;HDR=Yes;FMT=Delimited(' ')\""
//here I try a hex sequence which works with console.writeline() but not
with oleDB
connOle.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
+ s1 + ";Extended Properties=\"text;HDR=Yes;FMT=Delimited(\x20)\""
Any suggestions would be greatly appreciated for an escape sequence for a
space delimiter.
Thanks,
Rich
streamReader except it takes twice as long as an OleDBDataAdapter (using the
following delimiters: tabDelimited/comma/| pipe). My problem is in using a
space as the delimiter for reading a space delimited text file using OleDB.
Here are some sample connection strings for a tabDelimited text file or Pipe
Delimited (which both work fine):
string s1 = Application.StartupPath;
connOle.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
+ s1 + ";Extended Properties=\"text;HDR=Yes;FMT=TabDelimited\"";
connOle.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
+ s1 + ";Extended Properties=\"text;HDR=Yes;FMT=Delimited(|)\""
Note: oleDB also requires a schema.ini file to be placed in the same folder
as the text file to be read
save as schema.ini
[fileName.extention]
ColNameHeader=true
CharacterSet=ANSI
Format=Delimited(|)
I have tried variations for space delimiting without success
connOle.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
+ s1 + ";Extended Properties=\"text;HDR=Yes;FMT=Delimited(' ')\""
//here I try a hex sequence which works with console.writeline() but not
with oleDB
connOle.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
+ s1 + ";Extended Properties=\"text;HDR=Yes;FMT=Delimited(\x20)\""
Any suggestions would be greatly appreciated for an escape sequence for a
space delimiter.
Thanks,
Rich