Browse Source

* Patch to improve error message from LacaK2 (Bug ID 22061)

git-svn-id: trunk@21325 -
michael 13 years ago
parent
commit
a08ea239ca
1 changed files with 3 additions and 1 deletions
  1. 3 1
      packages/fcl-db/src/sqldb/mssql/mssqlconn.pp

+ 3 - 1
packages/fcl-db/src/sqldb/mssql/mssqlconn.pp

@@ -233,6 +233,7 @@ end;
 
 function TMSSQLConnection.CheckError(const Ret: RETCODE): RETCODE;
 var E: EMSSQLDatabaseError;
+    CompName: string;
 begin
   if Ret=FAIL then
   begin
@@ -240,7 +241,8 @@ begin
       case DBErrorNo of
         SYBEFCON: DBErrorStr:='SQL Server connection failed!';
       end;
-    E:=EMSSQLDatabaseError.CreateFmt('%s Error %d: %s'+LineEnding+'%s', [ClassName, DBErrorNo, DBErrorStr, DBMsgStr]);
+    if Self.Name = '' then CompName := Self.ClassName else CompName := Self.Name;
+    E:=EMSSQLDatabaseError.CreateFmt('%s : Error %d : %s'+LineEnding+'%s', [CompName, DBErrorNo, DBErrorStr, DBMsgStr]);
     E.DBErrorCode:=DBErrorNo;
     DBErrorStr:='';
     DBMsgStr:='';