1. Web Form

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="deleterecord.aspx.cs" Inherits="deleterecord" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <br />
    <table style="margin:auto; width:100% ; background-color:#123456" border="1"  ><tr><td>

    <div style="text-align:center; border:1px solid grey; margin:auto;  height:130px; color:White;">
<h3 style="text-align:center">DELETE EMPLOYEE RECORD</h3>Enter employee ecode : 
    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
    <asp:Button ID="Button2" runat="server" Text="Delete" onclick="Button1_Click" />
    <br />
    <asp:Label ID="Label1" runat="server" Text=""></asp:Label>   
</div>
</td></tr></table>
 <h2 id="mes" runat="server" style="text-align:center"></h2>
</asp:Content>

2. Web.Config

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
    <connectionStrings>
  <add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True"
   providerName="System.Data.SqlClient" />
 </connectionStrings>
 <system.web>
		<compilation debug="true" targetFramework="4.0"/>
	</system.web>
</configuration>

3. Code Behind

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;


public partial class deleterecord : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        bool b; int d;
        SqlConnection cnn = new SqlConnection();
        cnn.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
        SqlCommand cmd = new SqlCommand();
        cmd.CommandType = CommandType.Text;
        cmd.CommandText = "delete from employee where ecode=@ecode";
        b = int.TryParse(TextBox2.Text, out d);
        if (b == true)
        {
            cmd.Parameters.AddWithValue("@ecode", d);

            cmd.Connection = cnn;
            cnn.Open();
            
                int r = cmd.ExecuteNonQuery();
                if (r != 0)
                {
                    Label1.Text = "Data deleted successfull";
                    Label1.ForeColor = System.Drawing.Color.Green;
                    mes.InnerHtml = "Ecode " + TextBox2.Text + " Employee record deleted";
                    mes.Visible = true;
                }
            
            else
            {
                Label1.Text = "Record not found";
                Label1.ForeColor = System.Drawing.Color.Red;
                mes.Visible = false;
            }
            cnn.Close();
        }
        else
        {
            Label1.Text = "Enter Only numeric";
            Label1.ForeColor = System.Drawing.Color.Red;
            mes.Visible = false;
        }
    }  
}

4. Run the program

del_ado.net

5. Enter employee code which you want to delete & click to delete button..

Capture3

6. Record deleted

del_ado.net2