1 今天发现了一个问题:select分组后的数据不对,大小写没有区分开,经查证,确认默认不区分大小写,
2 若要区分大小写,需要将DataTable的caseSensitive属性设为true,dt.CaseSensitive = true;
DataTable dt = new DataTable(); dt.Columns.Add("id"); dt.Columns.Add("name"); DataRow dr = dt.NewRow(); dr["id"] = "1001"; dr["name"] = "MiNi"; dt.Rows.Add(dr); DataRow dr2 = dt.NewRow(); dr2["id"] = "1002"; dr2["name"] = "MINI"; dt.Rows.Add(dr2); DataRow dr3 = dt.NewRow(); dr3["id"] = "1003"; dr3["name"] = "MINI"; dt.Rows.Add(dr3); DataRow dr4 = dt.NewRow(); dr4["id"] = "1004"; dr4["name"] = "MiNi"; dt.Rows.Add(dr4); DataRow[] bakrows = dt.Select("", "name"); foreach (DataRow dre in bakrows) { Response.Write(dre[0] + dre[1].ToString()); }