private void showCustomer() { CustomerDB custDB = new CustomerDB(); DataTable dta = new DataTable(); dta = custDB.showCustomer(customerId); foreach (DataRow row in dta.Rows) { custId_mp_textBox.Text = row["customerId"].ToString(); fname_mp_textBox.Text = row["firstName"].ToString(); lname_mp_textBox.Text = row["lastname"].ToString(); address_mp_textBox.Text = row["address"].ToString(); city_mp_textBox.Text = row["city"].ToString(); state_mp_textBox.Text = row["state"].ToString(); postal_code_mp_textBox.Text = row["postalCode"].ToString(); country_mp_textBox.Text = row["country"].ToString(); dobPicker_mp.Value = Convert.ToDateTime(row["dateOfBirth"].ToString()); ssn_mp_textBox.Text = row["SSN"].ToString(); cell_phone_mp_textBox.Text = row["phone"].ToString(); email_mp_textBox.Text = row["email"].ToString(); uname_mp_textBox.Text = row["username"].ToString(); password_mp_textBox.Text = row["pword"].ToString(); } }
private void load_button_Click(object sender, EventArgs e) { CustomerDB custDB = new CustomerDB(); DataTable dta = new DataTable(); if (!string.IsNullOrWhiteSpace(custId_textBox.Text)) { int custId = Convert.ToInt32(custId_textBox.Text); if (custDB.selectCustomer(custId)) { dataLoaded = true; dta = custDB.showCustomer(Convert.ToInt32(custId_textBox.Text)); foreach (DataRow row in dta.Rows) { first_name_textBox.Text = row["firstName"].ToString(); last_name_textBox.Text = row["lastname"].ToString(); address_textBox.Text = row["address"].ToString(); city_textBox.Text = row["city"].ToString(); state_comboBox.SelectedItem = row["state"].ToString(); postal_code_textBox.Text = row["postalCode"].ToString(); country_comboBox.SelectedItem = row["country"].ToString(); dobPicker.Value = Convert.ToDateTime(row["dateOfBirth"].ToString()); ssn_textBox.Text = row["SSN"].ToString(); cell_phone_textBox.Text = row["phone"].ToString(); email_textBox.Text = row["email"].ToString(); uname_textBox.Text = row["username"].ToString(); password_textBox.Text = row["pword"].ToString(); } } else { MessageBox.Show("Invalid Customer ID"); editCustomer_clearUp(); } } }