chairyuan Posted October 10, 2003 Posted October 10, 2003 My DB is Access 2000. If I have my SQL string as SELECT * FROM CUSTMST or SELECT * FROM CUSTMST WHERE CUSTID = "ABCD" My program all return the right result. But if I use SELECT * FROM CUSTMST WHERE CUSTID LIKE "AB*" There is nothing returned. Why that happen? I tried the same SQL in Access itself, the result is fine. Help, please. Thanks Quote
bizzydint Posted October 10, 2003 Posted October 10, 2003 Cant see a reason for it, other than there's something wrong with your code containing the SQL string..... what are you using? Quote Grant me the serenity to accept the things I cannot change, the courage to change the things I cannot accept and the wisdom to hide the bodies of those people I had to kill today cos they pi**ed me off.
chairyuan Posted October 10, 2003 Author Posted October 10, 2003 I found it. We should use % instead of * in VB SQLstatement. So if I change my select to: SELECT * FROM CUSTMST WHERE CUSTID LIKE "AB%" it works. Quote
wyrd Posted October 10, 2003 Posted October 10, 2003 Access and SQL Server are a bit different. Access uses % and SQL Server uses * Quote Gamer extraordinaire. Programmer wannabe.
Administrators PlausiblyDamp Posted October 10, 2003 Administrators Posted October 10, 2003 SQL Server uses % Not sure about Access though.... Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
techmanbd Posted October 10, 2003 Posted October 10, 2003 I used "*" in access and I get a result. SELECT * FROM tblArtist WHERE Artist_Name LIKE 'So*'; And I get Social Distortion So why your,s doesn't work, don't know. Maybe you should throw up your code so we all can see. Maybe something in there. Quote Live as if you were to die tomorrow. Learn as if you were to live forever. Gandhi
techmanbd Posted October 10, 2003 Posted October 10, 2003 never mind, I see you found it, didnt read that part Quote Live as if you were to die tomorrow. Learn as if you were to live forever. Gandhi
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.