Background C # code:
Using system;using system.collections.generic;using system.linq;using system.web;using System.Web.UI;using System.web.ui.webcontrols;public partial class delete:system.web.ui.page{protected void Page_Load (object sender, Eve Ntargs e) {if (session["UID"]! = null) {if (! IsPostBack) {Testdatacontext context = new Testdatacontext (); Take the primary key value string code = request["Code"]. ToString (); Find Data Info = context.Info.Where (p = = P.code = = Code). First (); Delete//delete foreign key table var queryw = context. Work.where (p = = P.infocode = = code); Context. Work.deleteallonsubmit (QUERYW); var Queryf = context. Family.where (p = = P.infocode = = code); Context. Family.deleteallonsubmit (QUERYF); Delete itself context.Info.DeleteOnSubmit (data); Submit the context. SuBmitchanges (); Return to Response.Redirect ("main.aspx"); }} else {Response.Redirect ("denglu.aspx"); } }}
WB Example Delete