[問題] datatable select 用法
欄位 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
推
06/22 22:04, , 1F
06/22 22:04, 1F
→
06/22 22:05, , 2F
06/22 22:05, 2F
→
06/22 22:25, , 3F
06/22 22:25, 3F
→
06/22 22:25, , 4F
06/22 22:25, 4F
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):