Page 1 of 1

query with like

Posted: Wed 18 Jun 2014 17:50
by micoud
why this query generateb by dataset wizard of vs2010 won't work ?
no row at all ... also passing NumeroCig string in total

Code: Select all

SELECT ID, NumeroCig, ImportoIniziale, ImportoSpeso, Data
FROM            CIG
WHERE        (NumeroCig LIKE '%' + :Param1 + '%')
dll version 5.1.80.0

thanks

Re: query with like

Posted: Thu 19 Jun 2014 15:41
by Pinturiccio
You have sent us an invalid query. You can fix it in either of the following ways:
1. String concatenation operator in SQlite is '||' not '+':

Code: Select all

    SELECT ID, NumeroCig, ImportoIniziale, ImportoSpeso, Data
    FROM            CIG
    WHERE        (NumeroCig LIKE '%' || :Param1 || '%')
2. Include the whole condition to the parameter:

Code: Select all

    SELECT ID, NumeroCig, ImportoIniziale, ImportoSpeso, Data
    FROM            CIG
    WHERE        (NumeroCig LIKE :Param1)
Parameter value: "%value%".

Re: query with like

Posted: Mon 23 Jun 2014 13:47
by micoud
thanks :D