VS2005/GridView/rowDeleting

protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        SqlConnection con = DB.CreateConnection();
        SqlCommand cmd = new SqlCommand("delete from Categories where PKId =" + GridView1.DataKeys[e.RowIndex].Value.ToString(), con);
        con.Open();
        cmd.ExecuteNonQuery();
        con.Close();
    }
posted on 2007-08-10 23:53  tjo1984  阅读(168)  评论(0)    收藏  举报