protected void btnFindUserName_Click(object sender, EventArgs e) { //accesses dsAccounts data set finding last name dsAccounts dsFindUserName; //accesses Accounts.mdb database for the clsDataLayer string tempPath = Server.MapPath("Accounts.mdb"); clsDataLayer dataLayerObj = new clsDataLayer(tempPath); try { //finds lastName in dataset dsFindUserName = dataLayerObj.FindCustomer(txtUserName.Text); //if statement for user if they search by last name if (dsFindUserName.tblCustomers.Rows.Count > 0) { //finds last name if last name is placed in proper text field txtUserName.Text = dsFindUserName.tblCustomers[0].UserName; txtCity.Text = dsFindUserName.tblCustomers[0].City; txtState.Text = dsFindUserName.tblCustomers[0].State; txtLeastLanguage.Text = dsFindUserName.tblCustomers[0].LeastFavorite; txtFavoriteLanguage.Text = dsFindUserName.tblCustomers[0].FavoriteLanguage; Master.UserProgrammer.Text = "Record Found"; } else { //Adds comment if no records were found through searching for the LastName on the database Master.UserProgrammer.Text = "No records were found!"; } } catch (Exception error) { //Informs user that error occured if an exception was thrown string message = "Something went wrong - "; Master.UserProgrammer.Text = message + error.Message; } }