I want to pass 'A0101', 'A0201' this like a parameter in sql server query using in clause but from c# to a sp
Asked
Active
Viewed 43 times
0
-
Search out using this query "pass data table to procedure c#" – TheGameiswar Feb 24 '17 at 14:15
-
1http://stackoverflow.com/questions/11102358/how-to-pass-an-array-into-a-sql-server-stored-procedure – M. Rezaeyan Feb 24 '17 at 14:23
-
[You might read this](http://stackoverflow.com/a/33658220/5089204), Section "Dynamic IN statement" – Shnugo Feb 24 '17 at 14:53
1 Answers
0
If the "IN" clause is just being used to filter, you can use Linq without passing it into the stored procedure (it will still be evaluated on server with deferred execution).
var results = (from item in context.SPCall
where new[] {"A0101", "A0201"}.Contains(item.Property)
select item).ToList();

Kyle McClellan
- 664
- 7
- 23