-----先谢谢你们,请看看我那里错了,点击[删除]按钮为什么不相应删除动作呢?1 在Web窗体上放置一个Dbgrid1;
2 拖曳OleDbDataAdapter1到Web窗体上,出现“数据适配配置向导”,新建立连接一数据库,
  并正确完成向导的配置。此时web窗体自动出现一个OleDbConnection.
3 在Dbgrid1的属性生成器里面[列]-〉[按钮列-〉删除] 添加一删除列。其它数据绑定列正确。
4 我在DataGrid1_DeleteCommand事件下输入:
   try
  {

string delete ="DELETE FROM information where 姓名='"+e.Item.Cells[1].Text+"'";      //其中Dbgrid的第二绑定列为"姓名"
this.Label6.Text = "请输入完整的信息";

OleDbCommand comm = new OleDbCommand();
comm.CommandText = delete;
comm.Connection = this.oleDbConnection1;
//执行删除操作
this.oleDbConnection1.Open();
comm.ExecuteNonQuery();
this.oleDbConnection1.Close();

DataSet ds = new DataSet();
this.oleDbDataAdapter1.Fill(ds);
this.DataGrid1.DataSource =ds;
if (this.DataGrid1.Items.Count==1)
{
   this.DataGrid1.CurrentPageIndex--;
}
   this.DataGrid1.DataSource =ds;
   this.DataGrid1.DataBind();
  this.Label6.Text = "dfdfdfd";
}
catch (Exception error)
{
 this.Label6.Text = error.Message;
}

解决方案 »

  1.   

    是不是DataGrid1_DeleteCommand事件丢失,这是VS.net常有的事
      

  2.   

    string delete ="DELETE FROM information where 姓名='"+e.Item.Cells[1].Text+"'";      //其中Dbgrid的第二绑定列为"姓名
    "
    中的姓名是不是写错了?应该写information中对应字段吧?比如:Name
      

  3.   

    试试修改DataGrid1的Autopostback属性啊
      

  4.   

    其实你用的是c#的语言,默认情况下是不绑定事情的,看看有这个代码没有
    private void InitializeComponent()
    {    
    this.DataGrid1.DeleteCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_DeleteCommand);
    }
    #endregion
      

  5.   

    你端点执行看到执行到哪里了呢?
    我觉得 itants(郁闷的冰箱)这个的说法就对了阿
      

  6.   

    分数照给各位,原因我找到了,
         在Dbgrid1属性生成器里面将列删除,重新加入,但是一定要先点[应用]后点[确定]
         就能找到事件
         ----郁闷,这是什么道理啊!