Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Configuration;
- using System.Data.OleDb;
- using System.Data.SqlClient;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- public partial class Register : System.Web.UI.Page
- {
- FutureProspects site;
- protected void Page_Load(object sender, EventArgs e)
- {
- lblErrorReg.Text = "";
- if (Session["currentSite"] == null)
- {
- site = new FutureProspects();
- Session["currentSite"] = site;
- }
- else
- {
- site = (FutureProspects)Session["currentSite"];
- }
- }
- protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
- {
- }
- protected void btnRegRegister_Click(object sender, EventArgs e)
- {
- string title = dropDownRegTitle.Text;
- string fName = txtRegFirstName.Text;
- string mName = txtRegMiddleName.Text;
- string lName = txtRegSurname.Text;
- string maiden = txtRegMaidenName.Text;
- int day = int.Parse(txtRegDay.Text);
- int month = int.Parse(txtRegMonth.Text);
- int year = int.Parse(txtRegYear.Text);
- DateTime DOB = new DateTime(year, month, day);
- string gender = dropDownRegGender.Text;
- string telNum = txtRegTelNum.Text;
- string mobNum = txtRegMobNum.Text;
- string email = txtRegEmail.Text;
- string ID = "01";
- string street = txtRegStreet.Text;
- string town = txtRegTown.Text;
- string city = txtRegCity.Text;
- string county = txtRegCounty.Text;
- string country = txtRegCountry.Text;
- string postcode = txtRegPostcode.Text;
- string disabilities = txtRegDisabilities.Text;
- string type = "Full-Time";
- string password = txtRegPassword.Text;
- string confirmPass = txtRegConfirmPassword.Text;
- Address address = new Address(ID, street, town, city, county, country, postcode, type);
- string message = "";
- string error = "";
- if (password == confirmPass)
- {
- String connectionString = ConfigurationManager.ConnectionStrings["StuartRossDB"].ConnectionString;
- OleDbConnection connection = new OleDbConnection(connectionString);
- string query = "INSERT INTO Student (Title, FirstName, MiddleName, LastName, MaidenName, Gender, DateOfBirth, TelNum, MobNum, Email, Disabilities, Address, Password) VALUES('"
- + title + "','"
- + fName + "','"
- + mName + "','"
- + lName + "','"
- + maiden + "','"
- + gender + "','"
- + DOB + "','"
- + telNum + "','"
- + mobNum + "','"
- + email + "','"
- + disabilities + "','"
- + address + "','"
- + password + "')";
- OleDbCommand command = new OleDbCommand(query, connection);
- try
- {
- connection.Open();
- command.ExecuteNonQuery();
- }
- catch (Exception ex)
- {
- message = ex.ToString();
- }
- connection.Close();
- }
- else
- {
- error = "Error: Passwords Do Not Match";
- }
- lblErrorReg.Text = error;
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- Response.Redirect("SignIn.aspx");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement