Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2003
    Posts
    2

    Unanswered: Like operator with VB\ADO not working

    I am trying to implement a search feature for a contact program. The VB\ADO code statement is:

    Dim rs as NEW ADODB.Recordset

    With rs
    .CursorLocation = adUseClient
    .CursorType = adOpenKeyset
    .LockType = adLockPessimistic
    .Source = "SELECT * FROM Contacts WHERE FullName LIKE '*a*';"
    .ActiveConnection = dbConnection 'ado connection object
    .Open
    End With

    It returns 0 records whe executing from vb (77 when running from Access). Is there some limitation when using the like statement from VB\ADO?

  2. #2
    Join Date
    Jan 2003
    Posts
    2
    I figured out the solution, use (%) instead of (*) when calling from VB\ADO:

    SELECT * FROM Contacts WHERE FullName LIKE '%a%';

Posting Permissions

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