ADO connecting to a Text File

Can someone please tell me why the following code

txtPath := GetCurrentDir + 'DataPoints.txt';
ADODataSet1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;' +
'Data Source=' + txtPath + ';' +
'Extended Properties="text;HDR=No;"';
ADODataSet1.CommandText := 'SELECT * FROM ' + txtPath;

complains that the path is invalid? The text file is correctly named and exists where txtPath reports it to be. It is a simple comma-delimited file with x/y coordinates for a graph, e.g. y=x squared:

4,16.00 etc.

I've just about exhausted my limited knowledge of Delphi 7. Many thanks.


  • I realize this is old, but I am curious if you got an answer? Looking at the code I was thinking that your select statement should have been

    'SELECT * FROM DataPoints.txt'; instead of
    'SELECT * FROM ' + txtPath;

    Was that the problem?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion