Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2004
    Posts
    7

    Question Unanswered: ADO and like operator

    Hi,

    I'm using Delphi, ADO and Access 2000. I trying this query directly in Access and it' working fine :

    delete * from test_inspection where no_test_code like '3*';

    When trying it using ADO in Delphi, it's not working. I have no error but nothing is deleted. Do you have an idea??

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by dbernier2201
    Hi,

    I'm using Delphi, ADO and Access 2000. I trying this query directly in Access and it' working fine :

    delete * from test_inspection where no_test_code like '3*';

    When trying it using ADO in Delphi, it's not working. I have no error but nothing is deleted. Do you have an idea??
    Try replacing your "*" with a "%" sign ... You use * within QBE but ADO uses the % sign as the wildcard ...

  3. #3
    Join Date
    Apr 2004
    Posts
    7
    Thanks, that's working. The only think that isn't working is when I try to use a parameter

    delete from test_inspection where no_test_code like :no_test.

    To use it like if it was a parameter I use to concatenate my paramter to the query at Run-Time :
    qry.sql.append(delete from test_inspection where no_test_code like + quotedStr(temp + '%'));

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by dbernier2201
    Thanks, that's working. The only think that isn't working is when I try to use a parameter

    delete from test_inspection where no_test_code like :no_test.

    To use it like if it was a parameter I use to concatenate my paramter to the query at Run-Time :
    qry.sql.append(delete from test_inspection where no_test_code like + quotedStr(temp + '%'));
    Well since I don't know anything about Dephi except it's based on PASCAL, try getting your SQL statement to look like:

    DELETE FROM SomeTable WHERE ( SomeThing LIKE 'SomeThingElse%');

    Use Delphi to concat a string together so that it looks like that ...

Posting Permissions

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