如何获得dbexpress操作interbase和oracle数据库的错误代码?

解决方案 »

  1.   

    我刚测试的with SQLQuery1 do
      begin
        Close;
        SQL.Clear;
        SQL.Text := 'SELECT seq1 FROM bom1';
        try
          Open;
        except
          on e:EDBEngineError do
            //ShowMessage(pchar(e.Message));
            ShowMessage(pchar(e.Errors[0].ErrorCode));
        end;
      end;OK.
      

  2.   

    相应的DBExpress驱动同时还应该提供一个xxx.msg文件,比如interbase的驱动提供了interbase.msg,里面就是错误信息和代码。UIB提供了一个这个msg的reader读出来类似这样的内容UIBError_1 = 'arithmetic exception, numeric overflow, or string truncation';
    UIBError_2 = 'invalid database key';
    UIBError_3 = 'file %s is not a valid database';
    UIBError_4 = 'invalid database handle (no active connection)';
    UIBError_5 = 'bad parameters on attach or create database';
    UIBError_6 = 'unrecognized database parameter block';
    UIBError_7 = 'invalid request handle';
    UIBError_8 = 'invalid BLOB handle';
    UIBError_9 = 'invalid BLOB ID';
    UIBError_10 = 'invalid parameter in transaction parameter block';
    UIBError_11 = 'invalid format for transaction parameter block';
    UIBError_12 = 'invalid transaction handle (expecting explicit transaction start)';
    UIBError_13 = 'internal gds software consistency check (%s)';
    UIBError_14 = 'conversion error from string "%s"';
    UIBError_15 = 'database file appears corrupt (%s)';
    UIBError_16 = 'deadlock';
    UIBError_17 = 'attempt to start more than %ld transactions';
    UIBError_18 = 'no match for first value expression';
    UIBError_19 = 'information type inappropriate for object specified';
    UIBError_20 = 'no information of this type available for object specified';
    UIBError_21 = 'unknown information item';
    UIBError_22 = 'action cancelled by trigger (%ld) to preserve data integrity';
    UIBError_23 = 'invalid request BLR at offset %ld';
    UIBError_24 = 'I/O error for file %.0s"%s"';
    UIBError_25 = 'lock conflict on no wait transaction';
    UIBError_26 = 'corrupt system table';
    UIBError_27 = 'validation error for column %s, value "%s"';
    UIBError_28 = 'no current record for fetch operation';
    UIBError_29 = 'attempt to store duplicate value (visible to active transactions) in unique index "%s"';
    UIBError_30 = 'program attempted to exit without finishing database';
    UIBError_31 = 'unsuccessful metadata update';
    UIBError_32 = 'no permission for %s access to %s %s';错误代码和错误信息。
    我想找个汉化的,估计没有:(
      

  3.   

    .....
    UIBError_210016 = 'Average data length: %s, total dup: %ld, max dup: %ld';
    UIBError_210017 = 'Fill distribution:';
    UIBError_210018 = 'Expected data on page %ld';
    UIBError_210019 = 'Expected b-tree bucket on page %ld from %ld';
    UIBError_210020 = 'unknown switch "%s"';
    UIBError_210021 = 'Available switches:';
    UIBError_210022 = '-a      analyze data and index pages';
    UIBError_210023 = '-d      analyze data pages';
    UIBError_210024 = '-h      analyze header page';
    UIBError_210025 = '-i      analyze index leaf pages';
    UIBError_210026 = '-l      analyze log page';
    UIBError_210027 = '-s      analyze system relations';
    UIBError_210028 = '-z      display version number';
    UIBError_210029 = 'Can''t open database file %s';
    UIBError_210030 = 'Can''t read a database page';
    UIBError_210031 = 'System memory exhausted';
    UIBError_210032 = '-u      username';
    UIBError_210033 = '-p      password';
    UIBError_210034 = '-r      analyze record versions';
    UIBError_210035 = '-t      analyze specific tables';2887 messages found.