0
我有一个DataGridView,我打电话从phpMyAdmin的价值观和我尝试添加它的价值行,但是当我编辑的细胞1它得到相同的值从数据库获取价值并添加它的价值?
MySqlConnection conn = new MySqlConnection("datasource=localhost;port = 3306;username = root;password = ");
MySqlCommand comm = new MySqlCommand("select Fee,Amount from system.other_school_fees ;", conn);
MySqlDataAdapter ssda = new MySqlDataAdapter();
ssda.SelectCommand = comm;
DataTable ddbdataset = new DataTable();
ssda.Fill(ddbdataset);
BindingSource bbsource = new BindingSource();
bbsource.DataSource = ddbdataset;
dataGridView2.DataSource = bbsource;
ssda.Update(ddbdataset);
dataGridView2.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
int d = 0;
for (int b = 0; b < dataGridView2.Rows.Count; b++)
{
d += Convert.ToInt32(dataGridView2.Rows[b].Cells[1].Value);
}
lblOSF.Text = d.ToString();
W8它应该是 的MySqlConnection康恩=新的MySqlConnection( “数据源=本地主机;端口= 3306;用户名=根;密码=”); MySqlCommand comm = new MySqlCommand(“select Miscellaneous_Fee,Amount from system.miscellaneoues;”,conn); – Damiel
编辑单元格后是否有任何代码运行?不幸的是,它不会重新计算自己。 –