using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient;

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

    }
    SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings.Get("con"));
    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            if (con.State == ConnectionState.Closed) con.Open();
            SqlCommand cmd = new SqlCommand("insert into branch values('" + txtBranchId.Text + "','" + txtBranchName.Text + "','" + txtAddress.Text + "','" + txtPhNo.Text + "','" + DateTime.Now.ToString("dd-MMM-yyyy") + "')", con);
            cmd.ExecuteNonQuery();
            con.Close();
            lbltext.Text = "Information Posted";
        }
        catch (Exception ex)
        {
            lbltext.Text = ex.Message;
        }

    }
   
    protected void Button2_Click(object sender, EventArgs e)
    {
        txtAddress.Text = "";
        txtBranchId.Text = "";
        txtBranchName.Text = "";
        txtPhNo.Text = "";
    }
}
