Board index » delphi » ADOQuery.LoadFromFile Problem
Gregory A. Dunn
Delphi Developer |
Gregory A. Dunn
Delphi Developer |
ADOQuery.LoadFromFile Problem2006-03-07 05:43:45 AM delphi73 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
Delphi Developer |
2006-03-07 08:56:25 PM
Re:ADOQuery.LoadFromFile Problem
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" <XXXX@XXXXX.COM>writes QuoteHello, |
Steve Zimmelman
Delphi Developer |
2006-03-07 09:24:16 PM
Re:ADOQuery.LoadFromFile Problem
There is now a QC report.
qc.borland.com/qc/wc/qcmain.aspx -Steve- "Gregory A. Dunn" <XXXX@XXXXX.COM>writes QuoteHello, |
Gregory A. Dunn
Delphi Developer |
2006-03-07 09:44:52 PM
Re:ADOQuery.LoadFromFile Problem
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" <XXXX@XXXXX.COM>writes QuoteThere is now a QC report. |