Search code examples
delphiauthenticationdatabase-connectiondelphi-xe6

Delphi xe6 - Database Login (Informix)


I'm making a login form on Delphi XE6 that reads an username and a password, and tries to make the connection to a database. Although I turn the LoginPrompt off, when it makes the connection it still pops up and only has the username written, the password it's blank.

I have the following code:

    SearchTab.DBCon := TSQLConnection.Create(self);
    SearchTab.DBCon.DriverName := 'Informix';
    SearchTab.DBCon.Params.Values['Hostname'] := 'XXXX';
    SearchTab.DBCon.Params.Values['DataBase'] := 'XXXX';
    SearchTab.DBCon.Params.Values['User_Name'] := UsernameEdit.Text;
    SearchTab.DBCon.Params.Values['Password']  := PwEdit.Text;

    SearchTab.DBCon.Connected:= True;

Solution

  • I assume DBCon is VCL control placed on SearchTab Form ? Just remove first line:

    SearchTab.DBCon := TSQLConnection.Create(self);
    

    or Set LoginPrompt to false in DBCon after You created it:

    SearchTab.DBCon.LoginPrompt:=false;
    

    You seem to use existing connection, but You create new, assigning default values
    ( including LoginPrompt) to DBCon.