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

[SQL] SQL Parameter with multiple values

Discussão em 'Outras Linguagens' iniciado por Stack, Novembro 9, 2024 às 23:22.

  1. Stack

    Stack Membro Participativo

    I am currently passing an SQL Parameter with one value.

    So right now I have :

    SqlParameter sqlParameter = new SqlParameter("@Parameter", SqlDbType.VarChar);
    sqlParameter.Value = ParameterValue


    and this is working fine in my WHERE clause in my SQL query.

    However now I want to leave the option to have multiple values passed in my WHERE.

    Instead of passing a regular string, I was thinking of passing a string with commas to separate the values.

    So SqlParameter.Value = "value1, value2, value3";

    and I want it to act like

    WHERE Parameter = value1 OR Parameter = value2 OR Parameter = value3

    Is there an easy way to do this where I dont actually have to modify my SQL query?

    Continue reading...

Compartilhe esta Página