Results 1 to 3 of 3

Thread: using "like" in SQL Statement

  1. #1
    Guest
    I have a table ("part") in Access 97 database which have two field "id" and "info".

    I use ADO connect to the database by following code:
    Code:
    dim Db as New Adodb.Connection
    
    Db.ConnectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & db_path & "\part.mdb"
    Db.Open
    then I use the following query;

    Code:
    dim rs as adodb.recordset
    set rs = db.execte("select * from part where info like 'M*'")
    However, the recordset don't have data but the table have two record which value = "Mother", "Man". So it should return two recrod!?

    I don't know what problem it is, but I have test the query in access and it is work!

    So please tell me why if anyone have solution, Thank!

  2. #2
    Lively Member
    Join Date
    Jun 2000
    Location
    A caravan park in the Midlands (UK)
    Posts
    101

    Lightbulb

    Have you tried "like 'ma%'? I know the larger DB's (SQL Server & Informix) prefer using the percent sign rather than an asterisk.
    Anakim

    It's a small world but I wouldn't like to paint it.

  3. #3
    Guest

    Talking

    Woo. It work, Thank!

Posting Permissions

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



Click Here to Expand Forum to Full Width