我有一个包含一些 ID 的列表。我想从 = ListLinkedIds 的 DataTable 中删除行
List<string> ListLinkedIds = new List<string>(); //This has values such as 6, 8, etc.
DataSet ds = new DataSet();
SqlDataAdapter da = null;
DataTable dt = new DataTable();
da = new SqlDataAdapter("SELECT TicketID, DisplayNum, TranstypeDesc, SubQueueId, EstimatedTransTime,LinkedTicketId FROM vwQueueData WHERE (DATEADD(day, DATEDIFF(day, 0, Issued), 0) = DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND QueueId = @QueueId AND SubQueueId = @SubQueueId AND LinkedTicketId != @LinkedTicketId AND Called IS NULL", cs);
da.SelectCommand.Parameters.AddWithValue("@QueueId", Queue);
da.SelectCommand.Parameters.AddWithValue("@SubQueueId", SubQueue);
da.SelectCommand.Parameters.AddWithValue("@LinkedTicketId", ListLinkedIds[x]);
da.Fill(ds);
//Removes from DataTable
for (int x = 0; x < ListLinkedIds.Count(); x++)
{
//Remove Row from DataTable Where ListLinkedIds[x]
}
gvMain.DataSource = ds;
gvMain.DataBind();
我试过 dt.Rows.RemoveAt(remove) 但这只会删除行号。我想删除 ListLinkedIds 中的每一行。