On 20/11/2012 15:20, Luk Vandelaer wrote:
You don't leave the while loop when you found the correct user.
Thanks again Luk,

For each record there will be a showstring call processed.

It should be something like:

var found: boolean;
....
       found := false;
       while not SQLQueryMySQL.EOF and not found do begin
          //Retrieved data fields and assigned to a string variables
          retUsername := SQLQueryMySQL.Fields[0].AsString;
          retPassword := SQLQueryMySQL.Fields[1].AsString;
          found :=  (getUsername = retUsername) AND
             (getPasswordHash = retPassword);
          SQLQueryMySQL.Next;
         end;
       if found then begin
             retFullname := SQLQueryMySQL.Fields[2].AsString;
             ShowString('Retrieving information for: ' + retUsername);
             StatusBarLogin.Update;
             sleep(2000);
             ShowString('Connected to server as: ' + retUsername +
                ', known as ' + retFullname);
       end
       else
             ShowString('Failed to connect using: ' + getUsername);
By putting the retFullname := SQLQueryMySQL.Fields[2].AsString; statement after the SQLQueryMySQL.Next; statement, this last statement makes the field fullname to jump to the next row, by selecting a wrong fullname for the credentials on check.

anyway thanks again for your debugging.

Luk

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus



--
Kind Regards

Eric Kom

System Administrator - Metropolitan College
 _________________________________________
/ You are scrupulously honest, frank, and \
| straightforward. Therefore you have few |
\ friends.                                /
 -----------------------------------------
   \
    \
        .--.
       |o_o |
       |:_/ |
      //   \ \
     (| Kom | )
    /'\_   _/`\
    \___)=(___/

2 Hennie Van Till, White River, 1240
Tel: 013 750 2255 | Fax: 013 750 0105 | Cell: 078 879 1334
[email protected] | [email protected]
www.kom.za.net | www.kom.za.org | www.erickom.co.za

Key fingerprint: 513E E91A C243 3020 8735 09BB 2DBC 5AD7 A9DA 1EF5


--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to