dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Find a record using ADODC - "LIKE *"

  1. #1
    Join Date
    Sep 2004
    Posts
    1

    Find a record using ADODC - "LIKE *"

    How to find a record using ADODC.find method to find a record "LIKE variable*"

    I want to use a variable + * , ie if content is "B" then it should take "LIKE 'B*'". Here instead of 'B' I want to use the variable name itself.

  2. #2
    Join Date
    May 2002
    Location
    Colombo,Sri Lanka
    Posts
    1,110

    Re: Find a record using ADODC - "LIKE *"

    Will this do ur work.
    Code:
    Adodc2.CommandType = adCmdText 
    Adodc2.RecordSource = "SELECT * from qryInterests1 WHERE [Gender] like '%" & Gender & "%'" 
    Adodc2.RecordSource = "SELECT * from qryInterests1 WHERE [Age] = '" & age & "'" 
    Adodc2.Refresh 
    If Adodc2.Recordset.EOF Then 
    MsgBox "No records found", vbOKOnly 
    End If

  3. #3
    Join Date
    Oct 2001
    Location
    Melbourne, Australia
    Posts
    576

    Re: Find a record using ADODC - "LIKE *"

    Careful which DB you are using too - some use "*" as the wildcard, others use "%", so if it doesn't work with one, try it with the other.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)