1 (edited by manixs2013 2018-05-25 09:31:26)

Topic: mysql login error message

HELLO MVD

Is there any way to change error message while connecting to mysql database?

Thanks in advance.

Post's attachments

Attachment icon Capture.PNG 12.35 kb, 206 downloads since 2018-05-25 

Re: mysql login error message

Hello.


You can change this message only if you connect to MySQL by script, example:

procedure Form1_OnShow (Sender: string; Action: string);
begin
     Application.ProcessMessages;

     {$MySQL disable_connectdialog}
     Form1.MySQLConnection.Server := '127.0.0.1';
     Form1.MySQLConnection.Port := 3306;
     Form1.MySQLConnection.Username := 'root';
     Form1.MySQLConnection.Password := 'password';
     Form1.MySQLConnection.Database := 'databasename';

     try
         Form1.MySQLConnection.Connect;
     except
         if Pos('#28000', ExceptionMessage)>0 then
         begin
            MessageBox('Access denied', 'Error', MB_OK+MB_ICONWARNING); // your message
         end;

         Form1.Close;
     end;

     if Form1.MySQLConnection.Connected then
     begin
         UpdateDatabase(''); // to fill ComboBoxes
         Form1.TableGrid1.dbUpdate; // if you have TableGrid on first form with option "Enable auto execution", you should call method dbUpdate manually
     end;


end;

Also you can create own dialog for connection to MySQL.

Dmitry.

Re: mysql login error message

Thank YOU sir. gREAT!