Passing parameter to SQL select statement IN clause acts weird.

前端 未结 4 1273
暗喜
暗喜 2021-01-21 11:38

I\'ve got the following query that returns 2 records (in DataSet\'s query builder)

SELECT        EmpID, Name, id
FROM          Users
WHERE        (CAST(id AS Var         


        
4条回答
  •  心在旅途
    2021-01-21 12:01

    Bibhas is correct. For me this worked:

    string param="'1234','4567'"; we can't use param as SQL Parameter(@param).

    command = new SqlCommand("SELECT * FROM table WHERE number IN (" + param + ")", connection);

    command.ExcecuteReader();

提交回复
热议问题