Microsoft.Jet text file query

  • Thread starter Thread starter Simple Simon
  • Start date Start date
S

Simple Simon

I'm trying to read a CSV file that happens to have some spaces in
it...(Land - Lot.csv) For some reason, the SQL statement can't find
the file...ne1?

// CSV file connection
strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\\Temp;Extended Properties=\"Text;HDR=YES;FTM=Delimited\"";
OleDbConnection oleCon = new OleDbConnection(strCon);
oleCon.Open();

strSQL = "SELECT * FROM Land - Lot.csv";
OleDbDataAdapter daRead = new OleDbDataAdapter(strSQL, oleCon);


TIA,
~Gordon
 
Hi Gordon,

Try using brackets around the file in the SQL Statement: [Land - Lot.csv]

Alex Papadimoulis
 
Hi Alex,
Thxs for replying...No go :(

~Gordon

Hi Gordon,

Try using brackets around the file in the SQL Statement: [Land - Lot.csv]

Alex Papadimoulis
Simple Simon said:
I'm trying to read a CSV file that happens to have some spaces in
it...(Land - Lot.csv) For some reason, the SQL statement can't find
the file...ne1?

// CSV file connection
strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\\Temp;Extended Properties=\"Text;HDR=YES;FTM=Delimited\"";
OleDbConnection oleCon = new OleDbConnection(strCon);
oleCon.Open();

strSQL = "SELECT * FROM Land - Lot.csv";
OleDbDataAdapter daRead = new OleDbDataAdapter(strSQL, oleCon);


TIA,
~Gordon
 
Wait! It does work...sorry, I forgot to update the filename in my
schema.ini file.

Thank you!

Hi Gordon,

Try using brackets around the file in the SQL Statement: [Land - Lot.csv]

Alex Papadimoulis
Simple Simon said:
I'm trying to read a CSV file that happens to have some spaces in
it...(Land - Lot.csv) For some reason, the SQL statement can't find
the file...ne1?

// CSV file connection
strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\\Temp;Extended Properties=\"Text;HDR=YES;FTM=Delimited\"";
OleDbConnection oleCon = new OleDbConnection(strCon);
oleCon.Open();

strSQL = "SELECT * FROM Land - Lot.csv";
OleDbDataAdapter daRead = new OleDbDataAdapter(strSQL, oleCon);


TIA,
~Gordon
 
Back
Top