I got a problem while trying to pass parameter with type array of int. What I have done so far as below but both methods failed.
Method 1 (Failed) :
int[] CategoryArray;
CategoryArray = new int[userItem.ListItemId.Count()];
int i=0;
foreach (int catID in userItem.ListItemId)
{
CategoryArray[i] = catID;
i++;
}
db.Database.ExecuteSqlCommand("delete from SupportRegion where UserId={0} and CategoryID not in ({1})", userItem.UserId, CategoryArray);
Method 2 (also failed) :
db.Database.ExecuteSqlCommand("delete from SupportRegion where UserId={0} and CategoryID not in ({1})", userItem.UserId, String.Join(",", userItem.ListItemId));
How can I make it possible in defining parameter as an array of integer?
thanks a lot