1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

"Order By" using a parameter for the column name

Discussão em 'Outras Linguagens' iniciado por Stack, Janeiro 15, 2021.

  1. Stack

    Stack Membro Participativo

    We would like to use a parameter in the "Order By" clause of a query or stored procedure created with the Visual Studio DataSet Designer.

    Example:

    FROM TableName
    WHERE (Forename LIKE '%' + @SearchValue + '%') OR
    (Surname LIKE '%' + @SearchValue + '%') OR
    (@SearchValue = 'ALL')
    ORDER BY @OrderByColumn


    This error is displayed:

    Variables are only allowed when ordering by an expression referencing
    a column name.

    Continue reading...

Compartilhe esta Página