看板 C_Sharp 關於我們 聯絡資訊
請教各位高手 小弟目前將勾選的值存到dataset裡面的table 然後想將值相加 就像是存到table之後的值是 1 2 3 4 5 6 7 8 9 然後是想要把直的相加 就是1+4+7和2+5+8和3+6+9 請問該怎麼寫 謝謝各位 下面是小弟目前的程式碼 //------------------------------------------------- SqlConnection Coon_Ca = new SqlConnection("server = (local); database = chuSQL; uid = sa; pwd = 750502"); SqlDataAdapter myAdapter = new SqlDataAdapter("SELECT Software_ID, Function1, Function2, Function3, price FROM [Software_Services]", Coon_Ca); DataSet Fu_Ca = new DataSet(); myAdapter.Fill(Fu_Ca, "CASE_MO"); double[] CASE_ID = new double[Fu_Ca.Tables["CASE_MO"].Rows.Count]; int true_num = 0; int false_num = 0; for (int i = 0; i < count; i++) { string id = "R" + i.ToString(); CheckBox a = new CheckBox(); a = (CheckBox)Table1.FindControl(id); if (a.Checked==true) { true_num++; for (int j = 0; j < Fu_Ca.Tables["CASE_MO"].Rows.Count; j++) // 這邊是將值依序放到dataset的table裡面 { int Soft_ID = Convert.ToInt16(Fu_Ca.Tables["CASE_MO"].Rows[i][0]); int case_F1 = Convert.ToInt16(Fu_Ca.Tables["CASE_MO"].Rows[i][1]); int case_F2 = Convert.ToInt16(Fu_Ca.Tables["CASE_MO"].Rows[i][2]); int case_F3 = Convert.ToInt16(Fu_Ca.Tables["CASE_MO"].Rows[i][3]); int case_F4 = Convert.ToInt16(Fu_Ca.Tables["CASE_MO"].Rows[i][4]); } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.126.143.154
burton7777:你可以試看看Araylist 03/31 00:15