You are on page 1of 1

conn.

Open();

SqlCommand cmd = new SqlCommand("SELECT max(can_autono) FROM


candidateregistration;", conn);
String query = "SELECT max(can_autono) FROM candidateregistration;";

cmd.Connection = conn;
cmd.CommandText = query;
SqlDataReader reader = cmd.ExecuteReader();

String x1 = null;
while (reader.Read())
{
x1 = reader["can_autono"].ToString();

if (x1 == null)
{
x1 = "1";
}

DateTime dt = new DateTime();


String.Format("{0:ddMMyyyy}", dt);
conn.Close();

conn.Open();
String dbname = "easyjobhrdcom";
String tablename = "CandidateRegistration";

if (!IsPostBack)
{

conn.Open();

String cancode_data = "1";


SqlCommand cmd = new SqlCommand("INSERT into candidateregistration
(cancode, FirstName, LastName, Email,Pwd,Mobile, Current_city,HQ_course,HQ_branch,
passout_month,passout_year, marks_per, marks_CGPA, txt_marks, College_location,
College_institute ,College_university) VALUES ('" + cancode_data + "','" +
txt_firstname.Text + "','" + txt_lastname.Text + "','" + txt_email.Text + "','" +
txt_pwd.Text + "'," + txt_mobile.Text + ",'" + drop_city.Text + "','" +
drop_course.Text + "','" + drop_branch.Text + "'," + passout_month.Text + ",'" +
passout_year.Text + "','" + rb_per.Checked + "','" + rb_cgpa.Checked + "','" +
txt_marks.Text + "','" + drop_location.Text + "','" + drop_institute.Text + "','" +
drop_university.Text + "')", conn);
cmd.ExecuteNonQuery();

You might also like