Datagridview保存更改? [英] Datagridview save change?
本文介绍了Datagridview保存更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试编码
添加按钮:
I try coded
Add button :
private void btn_add_Click(object sender, EventArgs e)
{
dataGridView1.Rows.Add();
int nRowIndex = dataGridView1.Rows.Count - 1;
dataGridView1.CurrentCell = dataGridView1.Rows[nRowIndex].Cells[0];
}
保存按钮:
Save Button :
dataGridView1.CurrentRow.Cells["Product_ID"].Value = txt_id.Text.ToString();
dataGridView1.CurrentRow.Cells["Product_Name"].Value = txt_name.Text.ToString(); ;
dataGridView1.CurrentRow.Cells["Unit"].Value = txt_unit.Text.ToString(); ;
dataGridView1.CurrentRow.Cells["Price"].Value = txt_price.Text.ToString(); ;
dataGridView1.CurrentRow.Cells["Stored"].Value = txt_stored.Text.ToString();
dataGridView1.Update();
当我关闭程序并打开agian数据时,请不要保存在ms-access中: (
When i close program and open agian data don't save in ms-access :(
推荐答案
您只需将数据保存到Datagridview而不是数据库中(ms-access):
look在同样的问题上尝试使用它:
使用vb.net更新数据库中的值 [ ^ ]
you just save data into Datagridview not in database(ms-access):
look at this same problem And try use it:
updating value in database using vb.net[^]
这篇关于Datagridview保存更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文