locked
LIKE doesn´t work in table adapter FillBy RRS feed

  • Question

  • I´m making web page with vb.asp  behind. I´m using dataset tableadapter wizard to add FillBy text search in database. I´m making select  from where  sql ask  is like this :

    SELECT        Id, IdFamilia, [Part Number], Value, Comment, TIPO, Descripción, [Footprint Path], [Footprint Ref], Manufacturer, Proveedor1, CANT, [C/Estim], UBICACIÓN, [UBIC FILA], [UBIC COL], [UBIC PROF], CODE, [Library Ref], [Library Path], Foto, Fotostream, UnitPrice
    FROM            COMPONENTES

    WHERE     Comment LIKE ?

    When I use  Query builder it work but when I use Preview Data, or runing application the query don´t work, return nothing. 

    It´s clear that is a bug, could you say me how to solve it. 

    Regards,


    JP Serafini

    • Moved by Bob Beauchemin Tuesday, November 12, 2013 3:37 AM Moved to the forum for .NET data clients
    Monday, November 11, 2013 8:02 PM

Answers

  • I find solution to this trouble, the ?  looking for parameter, this parameter is defined by wizard. I don´t  know why the wizard make parameter variable type WChar, this is fixed sized char var. I suppose when sql  is maked joining sql string to parameter the parameter is diferent that we thinking to look.

    Example

    %algo%    is that I like and sql with parameter make %algo                           % is not the same.

    I could change it manually but if I like to edit sql from wizard  parameters are changed again to WChar, this is a bug of Wizard 

    I hope this problem solved that wasted my time be useful to another guy.

    Regards,


    JP Serafini


    • Edited by jpser Wednesday, November 13, 2013 2:31 PM
    • Marked as answer by Fred Bao Wednesday, November 20, 2013 8:06 AM
    Wednesday, November 13, 2013 2:30 PM

All replies

  • Hello,

    As far as I know, the ‘LIKE’ operation is a specify one rather than ‘=’ that its parameter just use a ‘?’.

    For using ‘LIKE’ in DataSet, we could write the sql statement like below:

    SELECT        OrderID, OrderCode, OrderName
    
    FROM            [Order]
    
    WHERE        (OrderCode LIKE '%' + @Param1 + '%')
    

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Fred Bao Wednesday, November 20, 2013 8:06 AM
    • Unmarked as answer by jpser Wednesday, November 20, 2013 3:44 PM
    Tuesday, November 12, 2013 8:41 AM
  • I find solution to this trouble, the ?  looking for parameter, this parameter is defined by wizard. I don´t  know why the wizard make parameter variable type WChar, this is fixed sized char var. I suppose when sql  is maked joining sql string to parameter the parameter is diferent that we thinking to look.

    Example

    %algo%    is that I like and sql with parameter make %algo                           % is not the same.

    I could change it manually but if I like to edit sql from wizard  parameters are changed again to WChar, this is a bug of Wizard 

    I hope this problem solved that wasted my time be useful to another guy.

    Regards,


    JP Serafini


    • Edited by jpser Wednesday, November 13, 2013 2:31 PM
    • Marked as answer by Fred Bao Wednesday, November 20, 2013 8:06 AM
    Wednesday, November 13, 2013 2:30 PM