2010. október 5., kedd

BDE error codes by code


Problem/Question/Abstract:

Show/generate the BDE errors list.

Answer:

The list of errors of the BDE, we can obtain it investigating a little in the file bde.int
There we will see that the error codes are composed of a value ' base' and of an offset.

Here you have an invention to generate your listing of errors of the BDE:

Add 'dbiprocs' in the uses of your form
Put a TRichEdit (RE1)
And put this in the OnClick of a TButton:

procedure TForm1.Button1Click(Sender: TObject);
const
  Bases:array [1..24] of integer=(
    0,$2100,$2200,$2300,$2400,$2500,$2600,$2700,$2800,
    $2900,$2A00,$2B00,$2C00,$2D00,$2E00,$2F00,$3000,
    $3100,$3200,$3300,$3400,$3500,$3E00,$3F00);
var
   ErrorCod:integer;
   ErrorTexto:array [0..DBIMAXMSGLEN+1] of char;
   i,n:integer;
begin
  for i:=1 to 24 do
    for n:=0 to 255 do
    begin
      ErrorCod:=Bases[i]+n;
      DbiGetErrorString(ErrorCod,ErrorTexto);
      if ErrorTexto<>'' then
        Re1.Lines.Add('$'+IntToHex(ErrorCod,4)+' ('+
                      IntToStr(ErrorCod)+') = '+ErrorTexto);
      Application.ProcessMessages;
    end;
end;

Nincsenek megjegyzések:

Megjegyzés küldése