Database connection

I have successfully connected to Access database via ODBC. Now I would like to get rid of database login prompt (I dont need it - very annoying). Is there a way to do this?
MalensekAsked:
Who is Participating?
 
muldeyurConnect With a Mentor Commented:
Hi You can also try this :

Constructor TDb.Create;
begin
  DB := TdataBase.Create(nil);
  DB.OnLogin := DBLogin;
end;


procedure tDBMod.DBLogin(Database: TDatabase; LoginParams: TStrings);
// Set Password & UserName
begin
  LoginParams.Values['USER NAME'] := UserName;
  LoginParams.Values['PASSWORD'] := Password;
end;

When you do it like this it won't sho you the login prompt!!

regards,

Yuri
0
 
intheCommented:
hi,
if you have a TDatabase on the form you can set loginprompt to false; (in object inspector).
0
 
JaccoCommented:
apart from setting LoginPrompt to false you will also have to specify the username and password in the TDataBase.Parameters: something like:

USER=SYSDBA
PASSWORD=masterkey

Regards Jacco
0
 
MalensekAuthor Commented:
I have tried to use TDatabase component to login to database, but login prompt still exist.
0
 
wimmeyvaertCommented:
Hello Malensek,

Like INTHE said, have you set the LoginPrompt-property of your DataBase-component to False ?

I think Inthe has the best solution if the user don't have to login to the database.

Best regards,
The Mayor
0
All Courses

From novice to tech pro — start learning today.