I'm trying to do a raw SQL statement which resembles this
DELETE FROM db.T0590_CODE_STRING WHERE IN (1,1,2,3,5)
the values in the IN clause are from rowIds list so therefore I'm trying to use a string.Join() but then the values are implemented as a String and not an Integer. Is there a workaround?
public void DeleteRow(List<int> rowIds)
{
using (var db = new SkataModel())
{
var list = "(" + string.Join(", " , rowIds.Select(s => s)) + ")";
db.Database.ExecuteSqlCommand("DELETE FROM db.T0590_CODE_STRING WHERE IN " + list);
db.SaveChanges();
}
}
If anyone have insight in how to do this with Linq or PreparedStatements that would also be appreciated.