[Lazarus] SQL select problem

Reinier Olislagers reinierolislagers at gmail.com
Tue Nov 20 14:41:11 CET 2012


On 20-11-2012 13:47, Eric Kom wrote:
> the last usernameLogin field in the table as erickom and the first 2 ajm
> and ajm1.
> 
> on the authentication form, when I entered erickom and its password,
> everything goes well, when I entered an unknown username everything goes
> well as well like 'Failed to connect using: ' + getUsername; but when I
> entered the 2 first usernames that are in the table (ajm & ajm1) its not
> responding as expected, the if condition jump after display the message
> Retrieving information for: ' + retUsername to  Failed to connect using:
> ' + getUsername. Abnormal behave.
> 
> Please view below my code and Thank in advance:
> 
> if MySQL55.Connected=True then begin;
> 
>         //SQLQueryMySQL.SQL.Text := 'SELECT usernameLogin,
> passwordLogin, fullNameLogin FROM scholarly.login WHERE usernameLogin =
> '':getUsername'' AND passwordLogin = '':getPasswordHash''';
Apart from Luk's remarks,

I wouldn't use quotes around those parameters in the WHERE clause. The
parameters are meant to work around the quote problems.
I'd focus on getting the code above fixed as it's much more elegant: it
let's the DB engine focus on the query...

Groete,
Reinier




More information about the Lazarus mailing list