Esempio n. 1
0
  private void getdetailsMouseClicked(
      java.awt.event.MouseEvent evt) { // GEN-FIRST:event_getdetailsMouseClicked
    // TODO add your handling code here:
    det.setText("");
    String aid, an, ac, ad, aen, ap, ainfo = null;

    aid = (String) applist.getSelectedItem();
    connector ob = new connector();
    int a = Integer.parseInt(aid);
    try {
      Connection my = ob.connect();

      Statement s = my.createStatement();

      ResultSet rs = s.executeQuery("select * from  appinfo where appid=" + a);

      if (rs.next()) {
        //   applist.addItem(rs.getString("appid"));

        an = "App Name: " + rs.getString("appname");
        ac = "Cost: " + rs.getString("appcost");
        ad = "Desc: " + rs.getString("appdesc");
        aen = "Enhancements: " + rs.getString("appen");
        ap = "Power: " + rs.getString("apppow");

        ainfo = an + "\n" + ac + "\n" + ad + "\n" + aen + "\n" + ap + "\n\n";

        det.setText(ainfo);
      }
    } catch (Exception e) {
      System.out.println(e);
    }
  } // GEN-LAST:event_getdetailsMouseClicked
Esempio n. 2
0
  /** Creates new form ViewAppDetails */
  public ViewAppDetails() {
    initComponents();
    connector ob = new connector();

    try {
      Connection my = ob.connect();

      Statement s = my.createStatement();

      ResultSet rs = s.executeQuery("select appid from  appinfo");

      while (rs.next()) {
        applist.addItem(rs.getString("appid"));
      }
    } catch (Exception e) {
      System.out.println(e);
    }
  }
Esempio n. 3
0
  private void addMouseClicked(java.awt.event.MouseEvent evt) { // GEN-FIRST:event_addMouseClicked
    // TODO add your handling code here:

    String a, b, c, d, ee;
    c = (cphone.getText());
    a = cname.getText().trim();
    b = caddr.getText().trim();
    int cn = Integer.parseInt(c);
    System.out.println(cn);
    d = prefer.getText().trim();
    ee = "" + capid;
    connector ob = new connector();
    try {
      Connection my = ob.connect();

      Statement s = my.createStatement();

      s.execute(
          "insert into cinfo values("
              + cusid
              + ",'"
              + a
              + "',"
              + cn
              + ",'"
              + b
              + "','"
              + ee
              + "','"
              + d
              + "')");
    } catch (Exception e) {
      System.out.println(e);
    }
    this.setVisible(false);
  } // GEN-LAST:event_addMouseClicked
Esempio n. 4
0
  /** Creates new form AddCustomer */
  public AddCustomer() {
    initComponents();

    connector ob = new connector();
    int c = 0;
    try {
      Connection my = ob.connect();

      Statement s = my.createStatement();

      ResultSet rs = s.executeQuery("select cid,cappid from  cinfo");

      while (rs.next()) {
        c++;
      }

      rs = s.executeQuery("select cid,cappid from  cinfo");

      int k = 0;
      while (k < c) {
        rs.next();
        k++;
      }

      // rs.previous();

      capid = rs.getInt("cappid");
      cusid = rs.getInt("cid");
      capid++;
      cusid++;
      cappid.setText("" + capid);
      cid.setText("" + cusid);
    } catch (Exception e) {
      System.out.println(e);
    }
  }