diff --git a/source/dbconnection.pas b/source/dbconnection.pas index 02815b82..8215eb56 100644 --- a/source/dbconnection.pas +++ b/source/dbconnection.pas @@ -1602,10 +1602,19 @@ end; function TAdoDBConnection.GetLastError: String; var + Msg: String; + rx: TRegExpr; E: Error; begin E := FAdoHandle.Errors[FAdoHandle.Errors.Count-1]; - Result := Format(MsgSQLError, [E.NativeError, E.Description]); + Msg := E.Description; + // Remove stuff from driver in message "[DBNETLIB][ConnectionOpen (Connect()).]" + rx := TRegExpr.Create; + rx.Expression := '^\[DBNETLIB\]\[.*\](.+)$'; + if rx.Exec(Msg) then + Msg := rx.Match[1]; + rx.Free; + Result := Format(MsgSQLError, [E.NativeError, Msg]); end;