private void btnAdmin_Click_1(object sender, EventArgs e) { frmAdmin frmAdmi1n = new frmAdmin(myDb, clientID); frmAdmi1n.Show(); this.Close(); }
private void button1_Click(object sender, EventArgs e) { try { myDb.Open(); OleDbCommand command = new OleDbCommand(); command.Connection = myDb; command.CommandText = "INSERT INTO Klient(AgenteID,KlientNaam,KlientVan,KlientTelefoonNommer,KlientKredietwaardig,KlientStatus) values(" + clientID + ",'" + txtName.Text + "'," + "'" + txtSurname.Text + "','" + txtTelefoon.Text + "'," + checkBox1.Checked + ",'" + Convert.ToString(cbStatus.Text) + "');"; try { command.ExecuteNonQuery(); MessageBox.Show("Data saved"); myDb.Close(); //MessageBox.Show("DB Opened"); this.Close(); frmAdmin frmBack = new frmAdmin(myDb, clientID); } catch (Exception ex) { MessageBox.Show("Nie alle waardes is in gevul nie."); } } catch (Exception ex) { MessageBox.Show("Error" + ex); } }
private void btnSubmit_Click(object sender, EventArgs e) { try { myDb.Open(); myDb.Close(); MessageBox.Show("DB Opened"); this.Close(); frmAdmin frmBack = new frmAdmin(myDb, clientID); } catch (Exception ex) { MessageBox.Show("Error" + ex); } }
private void button1_Click(object sender, EventArgs e) { try { myDb.Open(); OleDbDataAdapter queryAdapter = new OleDbDataAdapter(@"SELECT * FROM Agent WHERE AgentNaam='" + txtName.Text + "'", myDb); string Query = "UPDATE Agent SET AgentNaam='" + txtName.Text + "', AgentVan='" + txtSurname.Text + "',AgentEpos='" + txtEpos.Text + "',AgentTelefoon='" + txtTelefoon.Text + "' WHERE AgentNaam='" + txtName.Text + "'"; OleDbCommand cmd = new OleDbCommand(Query, myDb); queryAdapter.InsertCommand = cmd; queryAdapter.InsertCommand.ExecuteNonQuery(); OleDbDataAdapter queryAdapter1 = new OleDbDataAdapter(@"SELECT * FROM Adres WHERE AdresID='" + adress + "'", myDb); string Query1 = "UPDATE Adres SET StraatNom='" + txtAdress.Text + "', StraatNaam='" + txtAdresNaam.Text + "' WHERE AdresID='" + adress + "'"; OleDbCommand cmd1 = new OleDbCommand(Query1, myDb); queryAdapter1.InsertCommand = cmd1; queryAdapter1.InsertCommand.ExecuteNonQuery(); myDb.Close(); MessageBox.Show("DB Opened"); this.Close(); frmAdmin frmBack = new frmAdmin(myDb, clientID); } catch (Exception ex) { MessageBox.Show("Error" + ex); } }
private void button1_Click_1(object sender, EventArgs e) { try { myDb.Open(); OleDbCommand command = new OleDbCommand(); command.Connection = myDb; command.CommandText = "INSERT INTO Klient(AreaID,AgentID,KlientID,AdresID,EiedomAantalBadkamers,EiedomAantalSlaapkamers,EiendomPrys" + ",EiendomSwembad,EiendomGarages,EiendomAantalVloere,EiendomOppervlakte,EiendomTipePlan,EiendomAdisioneleInligting,Verhuur/Verkoop) " + "values(" + cbArea.SelectedIndex + "," + cbAgent.SelectedIndex + "," + cbKleint.SelectedIndex + "," + 3 + "," + numBadkamers.Value + "," + numSlaapkamers.Value + "," + Convert.ToInt32(edtPrys.Text) + "," + cxbSwembad.Checked + "," + numGerages.Value + "," + numVloere.Value + "," + Convert.ToInt32(edtOppervlakte.Text) + ",'" + edtPlan.Text + "','" + edtAddInligting.Text + "','" + cbType.SelectedText + "');"; try { command.ExecuteNonQuery(); MessageBox.Show("Data saved"); myDb.Close(); //MessageBox.Show("DB Opened"); this.Close(); frmAdmin frmBack = new frmAdmin(myDb, clientID); } catch (Exception ex) { MessageBox.Show("Nie alle waardes is in gevul nie." + ex); } } catch (Exception ex) { MessageBox.Show("Error" + ex); } }
private void button1_Click(object sender, EventArgs e) { try { myDb.Open(); string wW = ""; string queryString = "SELECT * FROM Agent WHERE AgentID=" + clientID + ""; try { OleDbCommand command = new OleDbCommand(queryString, myDb); OleDbDataReader reader = command.ExecuteReader(); while (reader.Read()) { wW = reader.GetValue(5).ToString(); } reader.Close(); } catch { MessageBox.Show("Data nie gevind nie."); } if (wW != txtOud.Text) { MessageBox.Show("Wagwoord is nie reg nie."); txtOud.Clear(); } else if (txtNuwe.Text != txtHerhaal.Text) { MessageBox.Show("Nuwe wagwoord is nie dieselfde nie."); } else if (txtNuwe.Text == txtHerhaal.Text) { try { OleDbDataAdapter queryAdapter = new OleDbDataAdapter(@"SELECT * FROM Agent WHERE AgentID=" + clientID + "", myDb); string Query = @"UPDATE Agent SET AgentWagwoord= '" + txtNuwe.Text + "'"; OleDbCommand cmd = new OleDbCommand(Query, myDb); queryAdapter.InsertCommand = cmd; queryAdapter.InsertCommand.ExecuteNonQuery(); MessageBox.Show("Wagwoord is verander."); } catch { MessageBox.Show("Fout met die database."); } myDb.Close(); MessageBox.Show("DB Opened"); this.Close(); frmAdmin frmBack = new frmAdmin(myDb, clientID); } } catch (Exception ex) { MessageBox.Show("Error" + ex); } }