void del(Object Sender, EventArgs e) { string agent = Request.QueryString["CODNO"]; string sa=txtACode.Text.Trim(); int r=0; con.Open(); DataRow []rs; rs=ds.Tables["joining"].Select("agent='" + sa + "'"); //rs=ds.Tables["joining"].Select("agent='" + sa + "'"); r=rs.Length; if (txtACode.Text=="") { com=con.CreateCommand(); com.CommandText="delete * from joining where agent='" + agent + "'"; } else { if(r==0) { System.Web.UI.WebControls.Label lbl1=new System.Web.UI.WebControls.Label(); lbl1.ForeColor=System.Drawing.Color.Blue; lbl1.BackColor=System.Drawing.Color.Yellow; lbl1.Text="Please enter a velid cerification number to DELETE"; ph1.Controls.Add(lbl1); } else if(r>0) { DataRow dr; dr=rs[0]; com=con.CreateCommand(); com.CommandText="delete * from joining where agent='" + sa + "'"; } else { System.Web.UI.WebControls.Label lbl1=new System.Web.UI.WebControls.Label(); lbl1.ForeColor=System.Drawing.Color.Blue; lbl1.BackColor=System.Drawing.Color.Yellow; lbl1.Text="No Such Record Found"; ph1.Controls.Add(lbl1); } } try { com.ExecuteNonQuery(); System.Web.UI.WebControls.Label lbl1=new System.Web.UI.WebControls.Label(); lbl1.ForeColor=System.Drawing.Color.Blue; lbl1.BackColor=System.Drawing.Color.Yellow; lbl1.Text="Record DELETED"; ph1.Controls.Add(lbl1); } catch(Exception ex) { } con.Close(); }
ds
Tables[]
string agent = Request.QueryString["CODNO"].ToString();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)