Feb 6, 2021 #1 s_s_s Programmer Joined Feb 6, 2021 Messages 1 Location IR Hi Please help me implement the equivalent of the following command in Delphi 'select * from bimar WHERE bimar.fname LIKE '+ QuotedStr ('*') +'&'+ QuotedStr (Edit1.Text) +'&'+ QuotedStr ('*')
Hi Please help me implement the equivalent of the following command in Delphi 'select * from bimar WHERE bimar.fname LIKE '+ QuotedStr ('*') +'&'+ QuotedStr (Edit1.Text) +'&'+ QuotedStr ('*')
Feb 7, 2021 #2 mirtheil Programmer Joined Jun 20, 2001 Messages 1,556 Location US What have you tried? What problem are you having? What database are you using? Your statement seems wrong. It generates something like: Code: select * from bimar WHERE bimar.fname LIKE ''*''&''VALUE''&''*'' where VALUE is the value in Edit1.Text. Your SQL would probably be better like: Code: 'select * from bimar WHERE bimar.fname LIKE ' + QuotedStr ('*' + Edit1.Text +'*'); which gives a statement like: Code: select * from bimar WHERE bimar.fname LIKE '*VALUE*' That being said, your should probably use parameters. It protects better from SQL injection. Mirtheil http://www.mirtheil.com Upvote 0 Downvote
What have you tried? What problem are you having? What database are you using? Your statement seems wrong. It generates something like: Code: select * from bimar WHERE bimar.fname LIKE ''*''&''VALUE''&''*'' where VALUE is the value in Edit1.Text. Your SQL would probably be better like: Code: 'select * from bimar WHERE bimar.fname LIKE ' + QuotedStr ('*' + Edit1.Text +'*'); which gives a statement like: Code: select * from bimar WHERE bimar.fname LIKE '*VALUE*' That being said, your should probably use parameters. It protects better from SQL injection. Mirtheil http://www.mirtheil.com
Mar 3, 2021 #3 DjangMan Programmer Joined Jun 1, 2001 Messages 1,787 Location CA I recommend using this IIADOQuery object from whosrdaddy. It was a game-changer for me with regards to working with ADO queries in my code. http://www.tek-tips.com/viewthread.cfm?qid=1647984 Upvote 0 Downvote
I recommend using this IIADOQuery object from whosrdaddy. It was a game-changer for me with regards to working with ADO queries in my code. http://www.tek-tips.com/viewthread.cfm?qid=1647984