The built-in connection form appears automatically when the application starts. To disable the appearance of the form and automatic connection to the database, use a directive that must be placed in the script.
{$MySQL disable_connectdialog}
begin
end.
The use of this directive assumes that the connection to the database will be carried out using a script.
var
SQLCon: TMyConnection; // соединение с базой
...
SQLCon := TMyConnection(Form1.FindComponent('MySQLConnection')); // Form1 is main Form
...
function ConnectToDB(AServer: string = ''; APort: integer = 0; ADataBase: string = ''; AUsername: string = '';
APassword: string = ''): boolean;
begin
SQLCon.Server := AServer;
SQLCon.Port := APort;
SQLCon.Database := ADataBase;
SQLCon.Username := AUsername;
SQLCon.Password := APassword;
try
SQLCon.Connect;
Result := SQLCon.Connected;
except
Result := False;
end;
end;
I don’t know how to call the built-in connection form using a script.
Визуальное программирование:
блог и
телеграм-канал.