hi...
is there any event for detect if sometime connection lost,..
i'm using zeos 7 and mysql.
[ASK} Is there an event to notify when connection lost ?
Moderators: gto, EgonHugeist, olehs
-
- Fresh Boarder
- Posts: 5
- Joined: 10.06.2011, 04:42
- Location: Dumaguete City, Philippines
try this it worked for me
try
DM.Zeos.Connected := False;
DM.Zeos.HostName := mysql_hostname;
DM.Zeos.Protocol := 'mysql-5';
DM.Zeos.Database := mysql_database;
DM.Zeos.user := mysql_username;
DM.Zeos.Password := mysql_password;
DM.Zeos.Connected := true;
Except
On E: Exception do
begin
MessageDlg('Cannot connect to database "' + mysql_hostname + '"!.' + #13 + #10 + 'Please contact your system adminsitrator.', mtError, [mbOK], 0);
end;
end;
try
DM.Zeos.Connected := False;
DM.Zeos.HostName := mysql_hostname;
DM.Zeos.Protocol := 'mysql-5';
DM.Zeos.Database := mysql_database;
DM.Zeos.user := mysql_username;
DM.Zeos.Password := mysql_password;
DM.Zeos.Connected := true;
Except
On E: Exception do
begin
MessageDlg('Cannot connect to database "' + mysql_hostname + '"!.' + #13 + #10 + 'Please contact your system adminsitrator.', mtError, [mbOK], 0);
end;
end;
no, i mean notify if successfully connection got lost unexpected, your code will drop the connection, on idle thats maybe usefull, but if on edit, it will lost data...meltoywerks wrote:try this it worked for me
try
DM.Zeos.Connected := False;
DM.Zeos.HostName := mysql_hostname;
DM.Zeos.Protocol := 'mysql-5';
DM.Zeos.Database := mysql_database;
DM.Zeos.user := mysql_username;
DM.Zeos.Password := mysql_password;
DM.Zeos.Connected := true;
Except
On E: Exception do
begin
MessageDlg('Cannot connect to database "' + mysql_hostname + '"!.' + #13 + #10 + 'Please contact your system adminsitrator.', mtError, [mbOK], 0);
end;
end;
i have figure it out with function ping or pingserver...
what i wanted if there any event if connection lost, like unidac, event onlostconnection...
now i have been using thread to monitor connection every few second, lot of time to create syncronizing method on all interface because annoying invalid window handle..
but nevermind i have done...
thanks for reply...
-
- Fresh Boarder
- Posts: 5
- Joined: 10.06.2011, 04:42
- Location: Dumaguete City, Philippines