前台:
<asp:LinkButton ID="LinkButton2" runat="server" CommandArgument='<%# Bind("Id") %>' CommandName='del'>删除</asp:LinkButton>后台:protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "del")
        {
            if (DelArticle(Convert.ToInt32(e.CommandArgument)) == 1)
            {
                Response.Write("删除成功!");
                BindData();
            }
            else
                Response.Write("删除失败!");
        }
    }   public static int DelArticle(int id)
        {
            string sql = "delete Article where id=@id";
            return Execute(sql,CommandType.Text,new OleDbParameter("@id",id));
        }
    //执行增删改的操作
        public static int Execute(string sql, CommandType type, params OleDbParameter[] param)
        {
            int result = -1;
            OleDbConnection con = new OleDbConnection(conStr);
            OleDbCommand cmd = new OleDbCommand();
            cmd.CommandType = type;
            cmd.CommandText = sql;
            cmd.Connection = con;
            if (param.Length > 0)
                cmd.Parameters.AddRange(param);            try
            {
                con.Open();
                result = cmd.ExecuteNonQuery();               
            }
            catch (Exception ex)
            {
                con.Close();
                cmd.Dispose();
                throw ex;
            }
            finally
            {
                con.Close();
                cmd.Dispose();
            }
            return result;        }