1

添加 SQL 后尝试打开 TadsQuery 时出现 5400 AE_INTERNAL_ERROR。当我将相同的 SQL 直接放在 TadsQuery 中时,没有错误。您的帮助文件指示我联系 Advantage 技术支持,以便研发部门解决问题。技术支持建议我在这里发帖。

这是一段代码(Doug Johnson 建议):

if (Value = '**') or (StartUp) then
with DM1.qadSBSort do
begin
  DisableControls;
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;

以下是系统统计数据:

处理器:INTEL® Core™2 DUO CPU @ 2.00GHz 2.00 Ghz 已安装内存:4.00 GB 系统类型:64 位。操作系统:Windows 7。编程:Delphi 2010。优势版本:9.10 64bit 服务器:本地。表:免费。请指教。谢谢你,有一个美好的一天。

——鲍勃·安德鲁斯

4

3 回答 3

1

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';
于 2010-12-10T02:52:58.763 回答
1

以下是 ADS 错误代码列表: http: //devzone.advantagedatabase.com/dz/webhelp/advantage9.1/mergedprojects/adserror/err5xxx/advantage_5xxx_error_codes.htm

错误 # 5400状态

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.

我会在他们的新闻组上发布一些代码:http ://devzone.advantagedatabase.com/dz/content.aspx?key=7

或者获取开发者帐户并请求支持。

于 2010-12-03T03:37:34.510 回答
1

你的 SQL 没有意义。您的查询(对于 i = 1 的值)实际上是

SELECT SBName, SBPath FROM poSBSorted 
 WHERE [SBName LIKE 'A']
 ORDER BY SBName

这不是 Advantage 的有效 SQL,并生成

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

如果我将其更改为正确的 ADS SQL:

SELECT SBName, SBPath FROM poSBSorted 
 WHERE SBName LIKE 'A%'
 ORDER BY SBName

它适用于包含两个 Char(10) 列来表示 SBName 和 SBPath 的虚拟 poSBSorted db。

正如我在上面的评论中所说,发布您尝试使用的实际普通 SQL(或至少解释您的数据库架构、示例数据和您尝试获得的结果),也许有人可以帮助您。

于 2010-12-03T19:31:17.983 回答