Solved

use Like operator in ADO

Posted on 2002-03-28
4
237 Views
Last Modified: 2013-11-23
I am using ADO object , how can I use LIKE operator in ADO
please check the below coding , is it must to use a keyset cursortype
please give me how can I give SQL query in ADO coding while useing LIKE operator


     dc.connect
    dc.cmd.CommandText = "SELECT  p_name from quntity where p_name LIKE  '" & "Body*"   & "'"        
     
     Set dc.rs = New ADODB.Recordset
    dc.rs.CursorLocation = adUseClient
    dc.rs.CursorType = adOpenKeyset
    dc.rs.LockType = adLockPessimistic
    Set dc.rs.Source = dc.cmd
    dc.rs.Open
   
     dc.rs.MoveFirst
       
      Do While Not dc.rs.BOF
        cmbpname.AddItem (dc.rs.Fields(0))
       ' cmbweight.AddItem (dc.rs.Fields(1))
        dc.rs.MovePrevious
    Loop
 End If
0
Comment
Question by:yasinmon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 32

Accepted Solution

by:
Brendt Hess earned 50 total points
ID: 6903358
Use a percentage sign instead of an asterisk in the LIKE statement:

p_Name LIKE '" & "Body%" & "'"
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6903970
I guess there is no chance you will ever maintain your open questions, is there:

Questions Asked 9
Last 10 Grades Given B B  
Question Grading Record 2 Answers Graded / 2 Answers Received

Anthony
0
 

Author Comment

by:yasinmon
ID: 6905094
Mr. acperkins
    please explain your comments I don't understand what you mean by thise, becuz  I am new in EE.com
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6905498
Sorry, I did not notice you were new, but since I had pointed this out to you on on February 21, 2002 (see http://devx.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20269516) I thought by now you had figured it out.  

In any case let me explain:  The concept behind EE is simple, somebody asks a question and experts suggest solutions, after which the questioner can followup with clarifications, but ultimately he/she should award the points to the best solution.  If there is no solution offered than the question can be deleted.  All of this is explained in great detail in the EE Guidelines (http://devx.experts-exchange.com/jsp/cmtyQuestAnswer.jsp)

You currently have the following questions outstanding:
Bar coding  Date: 02/02/2002 07:20AM PST  
http://devx.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20262367
Threading Date: 02/02/2002 07:31AM PST
http://devx.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20262371
To store multiple data in single record Date: 02/13/2002 10:54PM PST
http://devx.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20266653
Connect ing Data Report using ADO objects Date: 02/21/2002 08:16AM PST  
http://devx.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20269516
Platform independent or not Date: 03/14/2002 04:52AM PST
http://devx.experts-exchange.com/jsp/qShow.jsp?ta=cplusprog&qid=20276871

You also may want to focus on the grading standards in the EE Guidelines.  A "B" is not the only grade available.

Anthony
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month10 days, 10 hours left to enroll

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question