mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-17 04:40:18 +08:00
Remove driver stuff from MS SQL error messages.
This commit is contained in:
@ -1602,10 +1602,19 @@ end;
|
|||||||
|
|
||||||
function TAdoDBConnection.GetLastError: String;
|
function TAdoDBConnection.GetLastError: String;
|
||||||
var
|
var
|
||||||
|
Msg: String;
|
||||||
|
rx: TRegExpr;
|
||||||
E: Error;
|
E: Error;
|
||||||
begin
|
begin
|
||||||
E := FAdoHandle.Errors[FAdoHandle.Errors.Count-1];
|
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;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user