看板 C_Sharp 關於我們 聯絡資訊
欄位 0 1 2 3 4 result a c t g t true c a t a q false 昨天講的不清楚 我想要的是 欄位是定義datatable 的column 名稱 下面的是row輸入的資料 我定義 column是這樣定義的 for (int i = 0; i < 4; i++) { DataColumn column = new DataColumn(i.ToString()); column.DataType = typeof(string); samples.Columns.Add(column); } DataColumn column1 = new DataColumn("result"); column1.DataType = typeof(bool); samples.Columns.Add(column1); 我想要將samples裡面select 欄位 4 內容是 t 的東西 我是這樣寫的 DataRow[] rows = samples.Select("'4' = 'a'"); 但是這樣他沒有把我想要的ROW輸出出來 是我有寫錯嗎 這樣COMPILE是可以過 但是 DataRow[] rows = samples.Select("result" + " = true"); 這樣寫就會有ROW出來 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.121.197.106
maxi326:哇,我還是第一次看到這樣用,幫不了你 06/22 22:04
maxi326:試試samples.Select("4" + " = a"); 06/22 22:05
Mo:若要形成filterExpression引數,請使用與建立DataColumn類別的 06/22 22:25
Mo:Expression 屬性值的相同規則 06/22 22:25