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

namespace _17_8
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string strConn = "Server=.;" + "DataBase=MyTestDB;" +
                             "Integrated Security=True";

            SqlConnection sCon = new SqlConnection(strConn);
            SqlCommand sc = new SqlCommand("Select Count(*) From Info", sCon);
            sc.Connection.Open();
            int Count = Convert.ToInt32(sc.ExecuteScalar());
            sc.Connection.Close();

            MessageBox.Show("Total Record: " + Count.ToString());
        }
    }
}