Hi,
here's what I found out. Given:
var validUsers = (from x in metadata.CTAC_USERS
where
(x.USERID.Trim().ToUpper() == aUserId.Trim().ToUpper())
&&
(x.PASSWORD == PasswordManager.EncodePassword(aPassword))
select x);
var validUser = validUsers.First();
Generated Sql query:
Query: SELECT * FROM (SELECT DISTINCT "LPLA_1"."RECNUM", "LPLA_1"."USERID", "LPLA_1"."FIRSTNAME", "LPLA_1"."MIDDLENAME", "LPLA_1"."LASTNAME", "LPLA_1"."PASSWORD", "LPLA_1"."LASTON", "LPLA_1"."ENABLED", "LPLA_1"."DEPARTMENT_REC" AS "GROUP_REC", "LPLA_1"."USER_GROUP_REC" FROM "COBRA"."CTAC_USERS" "LPLA_1" WHERE ( ( ( ( ( ( UPPER(TRIM("LPLA_1"."USERID"))) = :LPFA_11) AND ( "LPLA_1"."PASSWORD" = :PASSWORD2))))))) WHERE rownum <= 1
Parameter: :LPFA_11 : AnsiString. Length: 9. Precision: 0. Scale: 0. Direction: Input. Value: "AFEDERICI".
Parameter: :PASSWORD2 : AnsiString. Length: 32. Precision: 0. Scale: 0. Direction: Input. Value: "2E8164CB1177A22D635AD7F29886FDA4".
Apparently the problem is an extra ")" character right before the WHERE rownum<=1
If I remove that character, the query runs just fine.
That said, I am not sure why it needs a DISTINCT clause since I didn't specify any