看板 C_Sharp 關於我們 聯絡資訊
會出錯的其中一個原因是因為tableset裡面的結構是空的 所以找不到column2 將using(System.Data.DataTable tableset =....){} 內的程式改成下面試試 //先Fill da.Fill(tableset); tableset.Columns.Add(new DataColumn("item", typeof(string))); tableset.Columns["item"].Expression = "Column2+'TEST'"; //如果要運算某兩欄行的話 //tableset.Columns.Add(new DataColumn("item", typeof(int))); //tableset.Columns["item"].Expression = "Column1*column2"; gvKeyFeederName.DataSource = tableset; gvKeyFeederName.DataBind(); ※ 引述《f127doggpig (阿賢)》之銘言: : 小弟目前有個問題 : 就是GridView的DataSource資料表想再增加一行資料 : 也就是從原來資料庫select語法撈出來的資料的某一行資料 : 經過後台處理的值 成為新的資料行 : HTML中 GridView我已新增一個BoundField : DataField為新處理出來的資料行 命名為"item" : 後台程式碼及其他說明如下 : http://ppt.cc/0JlB : 謝謝指教 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.126.107.82