Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using "Like" in Sql with ADO

Status
Not open for further replies.

Hakim

Programmer
Jul 4, 2000
3
US
Dear friends,<br>my sql is as follows:<br><br>SELECT salesman_name, salesman_cd<br>FROM salesman<br>WHERE salesman_name like &quot;*a*&quot;;<br><br>when i assign this query to ADO control it does not retrieve any records but the same query runs fine in access and displays 3 records.<br>Why does ADO gives problem for such a query?<br>Can someone help me? any help would be highly appreciated.
 
Try doing the following Where clause:-<br><br>WHERE salesman_name alike &quot;%a%&quot;;<br><br>I had the very same problem when writing an ASP page for the internet.
 
Thanks a lot , it works fine.<br>But can you tell me why is there so much change in SQL syntax with ADO and DAO<br>Eg. &quot;like&quot; changes to &quot;alike&quot; <br>And i had a problem earlier for the sql below <br>select * from user where password=&quot;hakim&quot;;<br>it would give error and the proper syntax, which i got from someones help is:<br>select * from [user] where password1=&quot;hakim&quot;<br>I had to change the password field to password1. (Weird???)<br><br>Anyway thanks a lot.<br>
 
Hakim -<br><br>Microsoft has not always followed the SQL standard in their data-access products.&nbsp;&nbsp;They're getting better, is all I can say.<br><br>I was going to suggest that you check out DBMS Magazine's web site, but it seems that CMP media has gone trendy with it -- it's now called &quot;Intelligent Enterprise&quot; and seems to be devoid of real content.&nbsp;&nbsp;Sorry.<br><br>But you should be able to do a web search for ANSI SQL92, which is the standard most DBMS vendors seem to be following at the moment.<br><br>Chip H.<br>
 
when you use SQL statements, I believe you need to enclose the text in single quotes(') not double quotes(&quot;).<br><br> <p>Wally Wojciechowski<br><a href=mailto:wwojo@wilsonpet.com>wwojo@wilsonpet.com</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top