using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Data.Sql;
using System.Data;
using System.Configuration;
public partial class Reg : System.Web.UI.Page
{
string strConn = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
string str;
SqlCommand com;
int count;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
autogenerated();
}
}
void autogenerated()
{
SqlConnection con= new SqlConnection(strConn);
str= "select count (*) from Reg";
com = new SqlCommand(str,con);
con.Open();
count = Convert.ToInt16(com.ExecuteScalar())+1;
TextBox EmpId.Text = count.ToString();
TextBox EmpId.Enabled= false;
con.Close();
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(@"Data Source=VIJAY-PC\SQLEXPRESS;Initial catalog=Reg;Integrated Security=True");
con.Open();
string q = "Insert into Reg (EMPID,[EMP Name],[Account Holder],[Account Number],[Account IFSC Number],[Emp Email],[Emp Password],[Confrim Password],[Emp Photo])Values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "','" + TextBox6.Text + "','" + TextBox7.Text + "','" + TextBox8.Text + "','" + TextBox9.Text + "')";
SqlCommand com = new SqlCommand(q, con);
com.ExecuteNonQuery();
con.Close();
autogenerated();
}
}