//Adds click event that calls Data Layer method InsertCustomer. protected void btnAddCustomer_Click(object sender, EventArgs e) { //Creates a boolean to false if the add customer creates an error bool customerAddError = false; //accesses Accounts.mdb database for the clsDataLayer string tempPath = Server.MapPath("Accounts.mdb"); clsDataLayer myDataLayer = new clsDataLayer(tempPath); //Inserts Customer Information for all fields try { myDataLayer.InsertCustomer(txtUserName.Text, txtCity.Text, txtState.Text, txtLeastLanguage.Text, txtFavoriteLanguage.Text, txtDateCompleted.Text); } catch (Exception error) { customerAddError = true; string message = "Error adding customer, please check form data. "; Master.UserProgrammer.Text = message + error.Message; } if (!customerAddError) { ClearInputs(Page.Controls); Master.UserProgrammer.Text = "Customer Added Successfully"; } //Binds CustomerGridView() BindCustomerGridView(); }