Microsoft.Jet text file query

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
 
A

Alex Papadimoulis

Hi Gordon,

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

Alex Papadimoulis
 
S

Simple Simon

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
 
S

Simple Simon

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top