Change
string query = "Select * from Items WHERE ItemID = '"+strarray+"'";
to
string query = "Select * from Items WHERE ItemID IN (" + String.Join(",", strarray) + ")";
[Edit] - If the contents of strarray are strings then you need to surround them with single quotes e.g.
string query = "Select * from Items WHERE ItemID IN (" + String.Join(",", Array.ConvertAll(strarray, z => "'" + z + "'")) + ")";
I note that your comment said
Quote:
syntax error/ missing operator @ ItemID IN(,123,900C,....)
That initial comma between the brackets is happening because you have not populated the first element in the array - remember arrays are zero-based so the first element is in
[0]
, the second is in
[1]
, etc. Take care when you are populating the array.