Hi I have tried following and succeded in that.
string[] strArName = new string[2];
strArName[0] =
"Waukegan";
strArName[1] =
"Schaumburg";
and Then
var StationDetail1 = from p in db.LANEINFOs
where strArName.Contains(p.Name)
select new { p.StationID, p.Name };
And also it works for int[] array. but it does not work for char[] array.
so if I try
char[] strTemp = new char[2];
strTemp[0] =
'M';
strTemp[1] =
'F';var StationDetail1 = from p in db.LANEINFOs
where strTemp.Contains(p.SType) // SType is char field in database select new { p.StationID, p.Name };
it gives me compilation error like
Error 3 The type arguments for method 'System.Linq.Enumerable.Contains<TSource>(System.Collections.Generic.IEnumerable<TSource>, TSource)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
is it something that char[] array is not compatible in IN clause? I read this article from MS, but I am not clear on it http://msdn.microsoft.com/en-us/library/bb882672.aspx .
can anyone put some light on it, what I am doing wrong here?
Thanks
work smarter, Not Harder.
Bhavesh Patel