Howdy, Stranger!

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

Categories

ADO connecting to a Text File

hannesbhannesb Member Posts: 1
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;
ADODataSet1.Open;

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:

1,1.00
2,4.00
3,9.00
4,16.00 etc.

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

Comments

  • johncnolandjohncnoland Member Posts: 2
    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.