Hey guys,
Just wondering if anyone can help me out here. I have a procedure (shown below)which is called on the FormCreate event. This checks if it can connect to a database.
If it can't connect to it, I display a warning and close the application. Now here is the problem. The application closes, but if you ctrl+alt+delete it is still listed as a running process. I have tried using .close and Application.Terminate methods and can't think of anything else. I could possibly put a try-catch where it calls the procedure, but I doubt this will work either.
Any ideas?
Thanks heaps,
Adam
------------------------------------
There's no place like 127.0.0.1
------------------------------------
Just wondering if anyone can help me out here. I have a procedure (shown below)which is called on the FormCreate event. This checks if it can connect to a database.
If it can't connect to it, I display a warning and close the application. Now here is the problem. The application closes, but if you ctrl+alt+delete it is still listed as a running process. I have tried using .close and Application.Terminate methods and can't think of anything else. I could possibly put a try-catch where it calls the procedure, but I doubt this will work either.
Any ideas?
Thanks heaps,
Adam
Code:
//sets the database connection string
procedure TfrmMain.SetConnectionString;
begin
try
//set connection string
connString :=
'Provider=MSDASQL;' +
'DRIVER={MySQL ODBC 3.51 Driver};' +
'SERVER=QBserver' + //QBServer (or localhost for testing)
';DATABASE=quicken' +
';UID=root' +
';PASSWORD=';
except on E:Exception do
begin
MessageDlg('ODBC connnection failed.' + #13#10 +
#13#10 +
'Check ODBC 3.51 driver is installed.' ,
mtWarning, [mbOK], 0);
close; //close the application
//exit; //exit procedture
end;
end; {try}
//establish a directSQL connection to the database
if MySQLClient.connect('QBServer','root','','quicken',3306,'',false,0) then
frmMain.Caption := frmMain.caption + ' ' +
' --> Database connection established <--'
else
begin
MessageDlg('DirectSQL connnection failed.' + #13#10 +
#13#10 +
'Application will now close.' ,
mtWarning, [mbOK], 0);
close; //close the application
end;
end;
------------------------------------
There's no place like 127.0.0.1
------------------------------------