using System;
using System.Windows.Forms;
//---------------------------------
using System.Data;
using System.Data.SqlClient;

namespace _17_4
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        string strConn = "Server=.;" + "DataBase=MyTestDB;" +
                         "Integrated Security=True";
        SqlConnection sCon;
        SqlCommand sc;

        private void DeleteRecord()
        {
            string strDelete = "Delete From Info Where Student_Number = '" + textBox1.Text + "'";

            sCon = new SqlConnection();
            sCon.ConnectionString = strConn;

            sc = new SqlCommand();
            sc.CommandType = CommandType.Text;
            sc.CommandText = strDelete;
            sc.Connection = sCon;
            sc.Connection.Open();
            sc.ExecuteNonQuery();
            sc.Connection.Close();

            MessageBox.Show("Record Deleted");
        }

        private void button1_Click(object sender, EventArgs e)
        {
            DeleteRecord();
        }
    }
}