Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ADOQuery.LoadFromFile Problem

3 views
Skip to first unread message

Gregory A. Dunn

unread,
Mar 6, 2006, 4:43:45 PM3/6/06
to
Hello,

A am compiling a Delphi Win32 ADO database application in Delphi 2006 which
I originally wrote in Delphi 7. I am having a problem with using the
ADOQuery.SQL.LoadFromFile('FileName') method. Since the ADOQuery.SQL
parameter has been changed to TWideStrings, it seems like the SaveToFile and
LoadFromFile methods do not work correctly. You can no longer load a
standard text file with the LoadFromFile method.

Am I doing something wrong or is this just a new feature?

Thanks,
Greg Dunn


Steve Zimmelman

unread,
Mar 7, 2006, 7:56:25 AM3/7/06
to
That is weird. I just played around with it.

The statement should be:

'SELECT * FROM customers'

But ADOQuery1.SQL.LoadFromFile('TestSQL.txt') yields:

'???'#$2A20'???????sM customers'

The code for the TWideStrings.LoadFromFile is almost identical (except for the
filename type) to the code for TStringList.LoadFromFile. But for some reason
they do not yield the same results.

They both call a LoadFromStream, but the values retrieved from the stream are
quite different.

Looks like a bug to me.

The work-around would be to create a TStringList object to do the loading and
saving.

Procedure LoadSQLText ;
Var sl : TStringList ;
begin
sl := TStringList.Create ;
Try
sl.LoadFromFile('TestSQL.txt');
ADOQuery1.SQL.Text := sl.Text ;
ADOQuery1.Open ;
Finally
sl.Free ;
End;
end;

-Steve-

"Gregory A. Dunn" <gr...@eagleresearchcorp.com> wrote in message
news:440cad43$1...@newsgroups.borland.com...

Steve Zimmelman

unread,
Mar 7, 2006, 8:24:16 AM3/7/06
to
There is now a QC report.

http://qc.borland.com/qc/wc/qcmain.aspx?d=25811

-Steve-

"Gregory A. Dunn" <gr...@eagleresearchcorp.com> wrote in message
news:440cad43$1...@newsgroups.borland.com...

Gregory A. Dunn

unread,
Mar 7, 2006, 8:44:52 AM3/7/06
to
Thank you very much for your support. I think it is just a problem with
TWideStrings. If you just create a simple TWideStrings object and try
SaveToFile and LoadFromFile it has problems. Therfore every component which
uses TWideString(s) will have the same issue.

Thanks for adding the QC report.

Thanks,
Greg Dunn


"Steve Zimmelman" <s...@charter.nospam.net> wrote in message
news:440d8960$1...@newsgroups.borland.com...

0 new messages