Oldschool Posted January 15, 2008 Share Posted January 15, 2008 This code works perfectly in Access: SELECT [item_id] FROM [items] WHERE [item_name] LIKE '*SomeItemName*'; This code works in Autoit: $ItemName = "SomeItemName" $sQuery = "SELECT [item_id] FROM [items] WHERE [item_name] =" & Chr(34) & $ItemName & Chr(34) &";"oÝ÷ Ù8b±Êyö¢È§ëh"Ö®¶sbb33c´FVÔæÖRÒgV÷Cµ6öÖTFVÔæÖRgV÷C°¢b33c·5VW'ÒgV÷Cµ4TÄT5B¶FVÕöEÒe$ôÒ¶FV×5ÒtU$R¶FVÕöæÖUÒÄ´Rb33²¢gV÷C²fײ6"3Bfײb33c´FVÔæÖRfײ6"3BfײgV÷C²¢b33²²gV÷CoÝ÷ Ù«¢+ØÀÌØí%ѵ9µôÅÕ½ÐíM½µ%ѵ9µÅÕ½Ðì(ÀÌØíÍEÕÉäôÅÕ½ÐíM1 Pm¥Ñµ}¥tI=4m¥ÑµÍt]!Im¥Ñµ}¹µt1%-ÅÕ½ÐìµÀì ¡È Ì䤵Àì ¡È ÐȤµÀì ¡È ÌФµÀìÀÌØí%ѵ9µµÀì ¡È ÌФµÀì ¡È ÐȤµÀì ¡È Ì䤵ÀìÅÕ½ÐììÅÕ½ÐoÝ÷ Ù«¢+ØÀÌØí%ѵ9µôÅÕ½ÐíM½µ%ѵ9µÅÕ½Ðì(ÀÌØíÍEÕÉäôÅÕ½ÐíM1 Pm¥Ñµ}¥tI=4m¥ÑµÍt]!Im¥Ñµ}¹µt1%-ÅÕ½ÐìµÀìÅÕ½ÐìÌäì¨ÅÕ½ÐìµÀì ¡È ÌФµÀìÀÌØí%ѵ9µµÀì ¡È ÌФµÀìÅÕ½Ðì¨ÌäìÅÕ½ÐìµÀìÅÕ½ÐììÅÕ½Ðì Where am I off here? Link to comment Share on other sites More sharing options...
DjDeep00 Posted January 15, 2008 Share Posted January 15, 2008 (edited) @Oldschool..... Try this.. $sQuery = "SELECT [item_id] FROM [items] WHERE [item_name] LIKE '*" & $ItemName & "*' ;" (Take the Chr(34) out because you already have single quotes. When you are using "like" u will need to use the % symbol not the * symbol. (This will be the case if you are using this query in Oracle) Edited January 15, 2008 by DjDeep00 Link to comment Share on other sites More sharing options...
Oldschool Posted January 15, 2008 Author Share Posted January 15, 2008 @Oldschool..... Try this.. $sQuery = "SELECT [item_id] FROM [items] WHERE [item_name] LIKE '*" & $ItemName & "*' ;" (Take the Chr(34) out because you already have single quotes. When you are using "like" u will need to use the % symbol not the * symbol. (This will be the case if you are using this query in Oracle) Does not work... It's * in MSAccess Link to comment Share on other sites More sharing options...
Oldschool Posted January 15, 2008 Author Share Posted January 15, 2008 (edited) this fails too... $sQuery = 'SELECT [item_id] FROM [items] WHERE [item_name] LIKE ' & "'*" & $ItemName & "*'" &';'oÝ÷ Ù«¢+ØÀÌØíÍEÕÉäôÌäíM1 Pm¥Ñµ}¥tI=4m¥Ñµt]!Im¥Ñµ}¹µt1%-ÌäìµÀìÌäìÅÕ½Ðì¨ÌäìµÀìÀÌØí%ѵ9µµÀìÌäì¨ÅÕ½ÐììÌäì Edited January 15, 2008 by Oldschool Link to comment Share on other sites More sharing options...
weaponx Posted January 15, 2008 Share Posted January 15, 2008 (edited) DjDeep is correct. You should be using percent, not asterisk. BTW - The last two examples you posted are ugly and it should work just like this: $ItemName = "SomeItemName" $sQuery = "SELECT [item_id] FROM [items] WHERE [item_name] ='%" & $ItemName &"%';" Edited January 15, 2008 by weaponx Link to comment Share on other sites More sharing options...
Oldschool Posted January 15, 2008 Author Share Posted January 15, 2008 (edited) DjDeep is correct. You should be using percent, not asterisk. BTW - The last two examples you posted are ugly and it should work just like this: $ItemName = "SomeItemName" $sQuery = "SELECT [item_id] FROM [items] WHERE [item_name] ='%" & $ItemName &"%';"ƒoÝŠ÷ Ûú®¢×ˆv‰÷öÙ'£!É»¶¬zw^vêp¢¹"ž®¶ˆsbb33c·5VW'’ÒgV÷Cµ4TÄT5B¶—FVÕö–EÒe$ôÒ¶—FV×5Òt„U$R¶—FVÕöæÖUÒÄ”´RgV÷C²fײgV÷C²b33“²RgV÷C²fײb33c´—FVÔæÖRfײgV÷C²Rb33“²²gV÷C It's crazy because in MSAccess itself the query with % produces no desired results. You have to use * Thank you friends. Edited January 15, 2008 by Oldschool Link to comment Share on other sites More sharing options...
Oldschool Posted January 15, 2008 Author Share Posted January 15, 2008 DjDeep is correct. You should be using percent, not asterisk. BTW - The last two examples you posted are ugly and it should work just like this: $ItemName = "SomeItemName" $sQuery = "SELECT [item_id] FROM [items] WHERE [item_name] ='%" & $ItemName &"%';"oÝ÷ Ûú®¢×v÷öÙ'£!É»¶¬zw^vêp¢¹"®¶sbb33c·5VW'ÒgV÷Cµ4TÄT5B¶FVÕöEÒe$ôÒ¶FV×5ÒtU$R¶FVÕöæÖUÒÄ´RgV÷C²fײgV÷C²b33²RgV÷C²fײb33c´FVÔæÖRfײgV÷C²Rb33²²gV÷C It's crazy because in MSAccess itself the query with % produces no desired results. You have to use * Thank you friends Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now