I am getting a 5400 AE_INTERNAL_ERROR when I try to OPEN a TadsQuery after adding the SQL. When I place the same SQL directly in the TadsQuery , there is no error. Your Help File directs me to contact Advantage Technical Support so R & D can fix the problem. Technical Support suggested that I post here.
Here is a snipit of code (suggested by Doug Johnson):
if (Value = '**') or (StartUp) then
with DM1.qadSBSort do
begin
DisableContr开发者_StackOverflowols;
for i := 1 to 26 do
begin
if Active then Close;
Active := False;
HText := 'SELECT SBName, SBPath FROM poSBSorted ' +
' WHERE [SBName LIKE ''' + CHR(i + 64) + '''] ' +
' ORDER BY SBName';
SQL.Clear();
SQL.Text := HText;
try
try
Screen.Cursor := crHourGlass;
Open();
finally
Screen.Cursor := crDefault;
end;
except
On E: Exception do
begin
if( E.Message <> 'The SQL statement did not '+
'generate a cursor handle. Use ' +
'TAdsQuery.ExecSQL to execute SQL ' +
'statements that are not SELECT statements' )then
MessageDlg( E.Message, mtWarning, [ mbOK ], 0 );
end;
end;
Active := True;
Here are the system stats:
Processor: INTEL® Core™2 DUO CPU @ 2.00GHz 2.00 Ghz Installed Memory: 4.00 GB System type: 64bit. OS: Windows 7. Programming: Delphi 2010. Advantage version: 9.10 64bit Server: Local. Tables: Free. Please advise. Thank you and have a good day.
-Bob Andrews
Here is a list of ADS error codes: http://devzone.advantagedatabase.com/dz/webhelp/advantage9.1/mergedprojects/adserror/err5xxx/advantage_5xxx_error_codes.htm
Error # 5400 States
This error is an Advantage JDBC Driver internal error. Please send a small re-creation to Advantage Technical Support demonstrating the problem so that Advantage R&D can fix the issue.
I would post some code on their newsgroups: http://devzone.advantagedatabase.com/dz/content.aspx?key=7
Or get a developer account and request support.
Your SQL makes no sense. Your query (for a value of i = 1) is literally
SELECT SBName, SBPath FROM poSBSorted
WHERE [SBName LIKE 'A']
ORDER BY SBName
That is not valid SQL for Advantage, and generates
poQuery: Error 7200: AQE Error: State = 42000; NativeError = 2115; [iAnywhere Solutions][Advantage SQL Engine]Expected lexical
element not found: IN, NOT IN, LIKE, NOT LIKE, BETWEEN, NOT BETWEEN There was a problem parsing the WHERE clause in your
SELECT statement
If I change it to be proper ADS SQL:
SELECT SBName, SBPath FROM poSBSorted
WHERE SBName LIKE 'A%'
ORDER BY SBName
It works fine with a dummy poSBSorted db containing two Char(10) columns to represent SBName and SBPath.
As I said in my comment above, post the actual plain SQL you're trying to use (or at least explain your database schema, sample data, and the results you're trying to obtain), and perhaps someone can help you.
I can't duplicate the 5400 error that you are getting, but there are enough questions in the code snippet that you submit that I am going to give you some general guidelines. Without more code, I can't do much better for you than Ken did, but I will give you some things to try. I can't tell if you are using an ADSConnection or not, but you are going to have problems if you do not. Your SQL statement needs to be modified as Ken suggests. It doesn't work otherwise. You need to make sure your ADSQuery matches the table type that you are using.
The fact that I see DM1, might indicate that you are doing this in a DLL?
I guess the good news is that you are getting a weird error and the two of us who tried to duplicate it can accomplish what you are trying to accomplish, without the error, by making some simple changes.
As an additional note, you don't need to do both Active and Open. When you open your query it goes active or if you set Active to true, it opens the query. And, purely stylistically, you don't need the parens after the methods unless there are parameters. Neither one of those is causing your problem (I'd bet on an ADSconnection issue) but just a note.
The code change that I made to your SQL statement looks just like Ken's.
HText := 'SELECT SBName, SBPath FROM poSBSorted ' +
' WHERE SBName LIKE ''' + CHR(i + 64) + '%'' ' +
' ORDER BY SBName';
精彩评论