[問題] 有關雜湊 hashtable 巢狀
一個資料庫只有兩個欄位共三行資料
col2 | col2
A | A2
B | B2
C | C3
使用雜湊 存取資料
SqlDataReader reader = new SqlCommand(totsql, conn).ExecuteReader();
int tmpi = 0;
Hashtable phpary1 = new Hashtable();
while (reader.Read()) {
Hashtable phpary2 = new Hashtable();
phpary2.Add("remark" , reader["remark"].ToString() );
phpary2.Add("response", reader["response"].ToString() );
phpary1.Add(tmpi, phpary2);
tmpi++;
}
想知道
1.有沒有辦法使用foreach 讀取每一行 每一欄的資料?
2.有更好的辦法嗎? 感覺雜湊不是這樣用的 O_oa ?
--
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.218.112.35
推
11/23 17:59, , 1F
11/23 17:59, 1F
→
11/23 18:56, , 2F
11/23 18:56, 2F
→
11/23 18:57, , 3F
11/23 18:57, 3F
→
11/23 18:58, , 4F
11/23 18:58, 4F
→
11/23 18:58, , 5F
11/23 18:58, 5F
→
11/23 19:03, , 6F
11/23 19:03, 6F
→
11/23 22:43, , 7F
11/23 22:43, 7F
→
11/23 22:45, , 8F
11/23 22:45, 8F
討論串 (同標題文章)
完整討論串 (本文為第 1 之 3 篇):
C_Sharp 近期熱門文章
PTT數位生活區 即時熱門文章
10
25