基本上我有一個DataTable A(參見 - http://i.imgur.com/cvTMB.png),其中包含日期和相應的日期。C# - 檢查字符串是否在DataRow中
我也有一個包含天的列表中的零售商可以交貨(見 - http://i.imgur.com/fmSeg.png)其他DataTable乙
我想要做的是遍歷數據表中的每一行,如果這一天是DataTable中B然後將其顯示在屏幕上。
到目前爲止,我有這個,但現在我卡住了。
// Firstly call the stored procedure to obtain the list available delivery dates (this is basically today plus 14 days)
DataTable availableDatesRecord = new DataTable();
B2B.Data.CometB2BDB comet = new CometB2BDB();
StoredProcedure proc = comet.GetListOfAvailableDates(now);
DbDataReader reader = proc.ExecuteReader();
availableDatesRecord.Load(reader);
// Now we need to obtain the list of days we can deliver - this is all based on their postcode.
DataTable possibleDeliveryDayRecord = new DataTable();
proc = comet.GetDeliveryDatesByPostcode(postcode);
reader = proc.ExecuteReader();
possibleDeliveryDayRecord.Load(reader);
DataRow deliveryDays = possibleDeliveryDayRecord.Rows[1];
foreach (DataRow row in availableDatesRecord.Rows)
{
string deliveryDay = row["Day"].ToString();
}
這樣做的最有效方法是什麼?
Steven
你已經試過了什麼?你可以發佈你現有的代碼嗎? – codingbadger 2012-03-15 10:14:39
你的ListOfDays的類型是什麼?字符串,枚舉類型,...? – 2012-03-15 10:30:43