且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从gridview中删除行而不篡改数据库

更新时间:2023-12-03 13:07:10

一个与另一个无关。除非你明确告诉某些方法用更改来更新数据库,你可以删除DataGridView中的每一条记录,数据库都不会发生任何事情。
One has nothing to do with the other. Unless you specifically tell some method to update the database with the changes, you could delete every single record in the DataGridView and nothing will happen to the database.


hiiii,



试试这个



hiiii,

try this one

protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
    dt.Rows.RemoveAt(e.RowIndex);
    GridView1.DataSource = dt;
    GridView1.DataBind();
}