SQL.Text doesn't seem to be working in Delphi 10.3
Posted: Mon 17 Feb 2020 20:13
I have an import routine that sets up data in an array and loops to HiArr
On each loop it assigns the last name and first name like so...
ILName := ArrayofUser[x].LName; //ImportLastName
IFName := ArrayofUser[x].FName; //ImportFirstName
Now I need to see if the ILName and IFName already exist in the table.
**FADC is another unit that holds the tables in the project
**I prefix all TUniQuerys with UQ, so I know what they are (just telling for readability)
FADC.UQUserTBLTest.SQL.Clear;
FADC.UQUserTBLTest.SQL.Text := 'SELECT * from UserTBLTest WHERE UserLName = ' + ILName +
' AND UserFName = ' + IFName;
FADC.UQUserTBLTest.Open;
First record being imported from the array is ILName of 'Barr**', ILFName of 'Mary'
Debugger Exception is Project Inventory.exe raised exception classs EMSError with message 'Invalid column name 'Mary', Invalid Column name 'Barr**'.'.
Funny thing is I can do this earlier....
FADC.UQUserTBLTest.SQL.Text := 'SELECT * from UserTBLTest WHERE UserTypeIDNo = ' + InttoStr(UserTypeIDNo) +
' AND DistrictIDNo = ' + InttoStr(DistrictIDNo);
And get no "invalid column name" errors. Same format.
Anyone have a clue what I'm doing wrong?
Thanks!
On each loop it assigns the last name and first name like so...
ILName := ArrayofUser[x].LName; //ImportLastName
IFName := ArrayofUser[x].FName; //ImportFirstName
Now I need to see if the ILName and IFName already exist in the table.
**FADC is another unit that holds the tables in the project
**I prefix all TUniQuerys with UQ, so I know what they are (just telling for readability)
FADC.UQUserTBLTest.SQL.Clear;
FADC.UQUserTBLTest.SQL.Text := 'SELECT * from UserTBLTest WHERE UserLName = ' + ILName +
' AND UserFName = ' + IFName;
FADC.UQUserTBLTest.Open;
First record being imported from the array is ILName of 'Barr**', ILFName of 'Mary'
Debugger Exception is Project Inventory.exe raised exception classs EMSError with message 'Invalid column name 'Mary', Invalid Column name 'Barr**'.'.
Funny thing is I can do this earlier....
FADC.UQUserTBLTest.SQL.Text := 'SELECT * from UserTBLTest WHERE UserTypeIDNo = ' + InttoStr(UserTypeIDNo) +
' AND DistrictIDNo = ' + InttoStr(DistrictIDNo);
And get no "invalid column name" errors. Same format.
Anyone have a clue what I'm doing wrong?
Thanks!