一行代码搞定Oracle + DataGridView的 增删改查图文教程 操练环境 VS2010 sp1 + c# + Oracle + Win10 代码如下: using System; using System.Windows.Forms; using System.Data; namespace KEZZ { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { // TODO: 这行代码将数据加载到表“ds_kezz.dt_KEZZ”中。您可以根据需要移动或删除它。 this.dt_KEZZTableAdapter.Fill(this.ds_kezz.dt_KEZZ); } private void button2_Click(object sender, EventArgs e) { //插入一行 DataRow dr = ds_kezz.dt_KEZZ.Rows.Add("5217"); } private void button3_Click(object sender, EventArgs e) { //删除选中的行 dataGridView1.Rows.RemoveAt(dataGridView1.CurrentRow.Index); } private void button4_Click(object sender, EventArgs e) { //保存数据 dt_KEZZTableAdapter.Update(ds_kezz.dt_KEZZ); } private void dataGridView1_RowStateChanged(object sender, DataGridViewRowStateChangedEventArgs e) { //加行号 e.Row.HeaderCell.Value = (e.Row.Index + 1).ToString(); } } }
2021-08-18 16:44:58 1.81MB C#
1
C# 三层架构实现DataGridView与Listview的增删改!!!
2019-12-21 20:01:52 241KB DataGridView的增删改
1