BDE Error Code is confusing me...

hi all, I'm using Delphi6 & here's a piece of my code:

try
    StoredProc1.Close;
    StoredProc1.Open;
    while not StoredProc1.Eof do
    begin
      Memo1.Lines.Add(StoredProc1.FieldByName('name').AsString);
      StoredProc1.Next;
    end;
  except
    on E: Exception do
    begin
      if E is EDBEngineError then
        with E as EDBEngineError do
          StatusBar1.SimpleText := IntToStr(Errors[0].Errorcode);
    end;
  end;

If the DB connection is OK, the code works; if the DB disconnect just before
StoredProc1.Open, the ErrorCode I get is 9729. I lookup this ErrorCode in
the Delphi5's manual & found that 9729 means "violate primary key"(?!), I
also looked into BDE.int with D6 but hard to find out what 9729 means...

does anybody know what the BDE error codes mean? is the way I get the BDE
error code wrong?

in fact, the exact problem I'm dealing with is: if I got an error when
querying DB, how can I know that it's caused by error in SQL statements or
DB disconnection?

please help me~