rick_mulder
asked on
TQuery and SQL String
I'm using this query:
QueryTest.SQL.Add('Select * from TEST where Name = "' + TableNames['NAME'] + '"');
Ok. this works fine until the query reaches someone with the name "abcdf".
So what's happens is that the string looks like :
Select * from TEST where Name = ""abcd"" !!!
I also tried this :
QueryTest.SQL.Add('Select * from TEST where Name = ''' + TableNames['NAME'] + '''');
Replacing the "Â with ' works but when now someone has a name with '''' in it, the same problem occurs.
Is there a solution to my problem??
QueryTest.SQL.Add('Select * from TEST where Name = "' + TableNames['NAME'] + '"');
Ok. this works fine until the query reaches someone with the name "abcdf".
So what's happens is that the string looks like :
Select * from TEST where Name = ""abcd"" !!!
I also tried this :
QueryTest.SQL.Add('Select * from TEST where Name = ''' + TableNames['NAME'] + '''');
Replacing the "Â with ' works but when now someone has a name with '''' in it, the same problem occurs.
Is there a solution to my problem??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
try
QueryTest.SQL.Add('Select * from TEST where Name = ' + quotedStr(TableNames['NAME
meikl