Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void OpretMedlem() throws Exception {
- try {
- Connection connect = ConnectAll.getConnection();
- Statement stmt = connect.createStatement();
- stmt.executeUpdate("insert into Medlem values" + "( '" + txfIdOpret.getText() + "' , '"
- + txfNavnOpret.getText() + "' , '" + txfAdresseOpret.getText() + "' , '"
- + txfTelefonOpret.getText() + "' , '2017 - 09 - 26')");
- }
- catch (Exception e) {
- System.out.println(e);
- }
- }
- // public void OpretMedlem() throws Exception {
- // try {
- // PreparedStatement.this.setString(1, " ");
- // PreparedStatement.this.setInt(2, " ");
- // PreparedStatement.this.setString(3, " ");
- // PreparedStatement.this.setString(4, " ");
- // PreparedStatement.this.execute();
- //
- // }
- // catch (Exception e) {
- // System.out.println(e);
- //
- // }
- //
- // }
- public void OpdaterMedlem() throws Exception {
- try {
- Connection connect = ConnectAll.getConnection();
- Statement stmt = connect.createStatement();
- stmt.executeUpdate("update Medlem set Navn = '"
- + txfNavnOpdater.getText() + "' , Adresse = '" + txfAdresseOpdater.getText()
- + "' , Telefon = '"
- + txfTelefonOpdater.getText() + "' where Id = " + txfIdOpdater.getText());
- }
- catch (Exception e) {
- System.out.println(e);
- }
- }
- public void sletMedlem() {
- try {
- Connection connect = ConnectAll.getConnection();
- Statement stmt = connect.createStatement();
- stmt.executeUpdate("delete from Medlem where Id = " + txfIdOpdater.getText());
- stmt.executeUpdate(
- "delete from Holdmedlem where Medlem(Id) = " + txfIdOpdater.getText());
- }
- catch (Exception e) {
- System.out.println(e);
- }
- }
- public void hentMedlem() throws Exception {
- try {
- Connection connect = ConnectAll.getConnection();
- Statement stmt = connect.createStatement();
- ResultSet res =
- stmt.executeQuery("select * from medlem where Id = " + txfIdOpdater.getText());
- while (res.next()) {
- txfNavnOpdater.setText(res.getString(2));
- txfAdresseOpdater.setText(res.getString(3));
- txfTelefonOpdater.setText(res.getString(4));
- }
- updateControls();
- }
- catch (Exception e) {
- System.out.println(e);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement