C#使用Tableadapter进行update,Insert的操作
2013-02-06 18:06
387 查看
需要注意的是,调试时更新的数据库是 debug目录下的数据库;
private void updatebutton_Click(object sender, EventArgs e)
{
this.book_infoBindingSource.EndEdit();
this.book_infoTableAdapter.Update(this.bookstoreDataSet.book_info);
}
private void insertbutton_Click(object sender, EventArgs e)
{
//在datagridview里直接添加,选择datagridview的当前行的各个单元格数据进行更新,调试时,更新的是项目的debug目录下的数据库
this.book_infoTableAdapter.Insert(this.book_infoDataGridView.CurrentRow.Cells[0].Value.ToString(),this.book_infoDataGridView.CurrentRow.Cells[1].Value.ToString(), this.book_infoDataGridView.CurrentRow.Cells[2].Value.ToString(), this.book_infoDataGridView.CurrentRow.Cells[3].Value.ToString(), Convert.ToDateTime(this.book_infoDataGridView.CurrentRow.Cells[4].Value),this.book_infoDataGridView.CurrentRow.Cells[5].Value.ToString(), this.book_infoDataGridView.CurrentRow.Cells[6].Value.ToString());
}
private void updatebutton_Click(object sender, EventArgs e)
{
this.book_infoBindingSource.EndEdit();
this.book_infoTableAdapter.Update(this.bookstoreDataSet.book_info);
}
private void insertbutton_Click(object sender, EventArgs e)
{
//在datagridview里直接添加,选择datagridview的当前行的各个单元格数据进行更新,调试时,更新的是项目的debug目录下的数据库
this.book_infoTableAdapter.Insert(this.book_infoDataGridView.CurrentRow.Cells[0].Value.ToString(),this.book_infoDataGridView.CurrentRow.Cells[1].Value.ToString(), this.book_infoDataGridView.CurrentRow.Cells[2].Value.ToString(), this.book_infoDataGridView.CurrentRow.Cells[3].Value.ToString(), Convert.ToDateTime(this.book_infoDataGridView.CurrentRow.Cells[4].Value),this.book_infoDataGridView.CurrentRow.Cells[5].Value.ToString(), this.book_infoDataGridView.CurrentRow.Cells[6].Value.ToString());
}
相关文章推荐
- 在SQL Server中使用merge同时进行Insert,Update和Delete操作
- 使用merge关键字对数据进行 insert 或update操作
- C#使用Tableadapter进行变量的模糊查询
- SQL 游标使用的小例子,对于每行数据根据参数的不同进行Insert或Update操作.
- 在oracle数据库中,无法对数据表进行insert和update操作
- 使用C#对MongoDB中的数据进行查询,修改等操作
- C#中使用SQL的BULK语句,进行大数据量操作
- Oracle中用一条SQL语句直接进行Insert/Update的操作--merge into的使用
- 使用C#和Excel进行报表开发(五)-操作单元格边框和颜色
- 使用C#和Excel进行报表开发(二)-操作统计图(Chart)
- C#使用XmlDocument操作XML进行查询、增加、修改、删除、保存应用的实例(转载)
- 3.数据库操作相关术语,Oracle认证,insert into,批量插入,update tablename set,delete和truncate的差别,sql文件导入
- 关于Jpa使用Update方法进行更新操作,却没有同步到数据库的原因
- C#使用XmlDocument操作XML进行查询、增加、修改、删除、保存应用的实例(转载)
- Hql 也可以进行DML操作update delete insert
- 使用mybatis执行对应的SQL Mapper配置中的insert、update、delete等标签操作,数据库记录不变
- Command不是也可以对数据库进行insert,update,delete操作吗,为什么还需要DataAdapter。我知道DataAdapter可以用来想AataSet中填充数据,Command不可以吗?
- 使用C#和Excel进行报表开发(五)-操作单元格边框和颜色
- c#使用API进行模拟鼠标点击 底层操作同样简单
- C#使用消息(SendMessage)进行跨进程操作