reggea's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
6 (0.01 per day)
Joined:
25-July 12
Profile Views:
269
Last Active:
User is offline Mar 09 2014 07:52 PM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   reggea has not set their status

Posts I've Made

  1. In Topic: need to send data to dbase using a loginform

    Posted 30 Jul 2012

    View Postmacosxnerd101, on 27 July 2012 - 08:49 AM, said:

    Take a look at using a PreparedStatement and SQL insert query to insert the data into the database. Also, an AUTO INCREMENT constraint on the PK field is much cleaner than using your own database procedure. You can try using the getGeneratedKeys() method to get the new ID.

    Also, avoid using the NetBeans (or any other) GUI Builder, as the code it produces is horrid and unmaintainable. Write your own GUI code by hand.

    hey mac,thanks for the advice,i used the autoincrement and it works well thnx
  2. In Topic: jsp: form validation

    Posted 27 Jul 2012

    View Postjone kim, on 24 May 2012 - 03:16 AM, said:

    how to add java validation code??

    hey kim....i assume you have textboxes with different types of inputs i.e characters,emailaddresses,letters,numbers etc....all i can tell you is that just try and find the validation codes for all the textboxes so that you later use jsp 2 input and send to the database wherease the validation happens through java
    i ken give an example
    jTextField1.addKeyListener(new KeyAdapter() {//this is a textbox you have created
                @Override
            public void keyTyped(KeyEvent e) {
            input=jTextField1.getText();//gets the values you input
            String pattern = "[a-zA-Z]*";//string that is to validate
            boolean g= input.matches(pattern);//checks if validation is valid
            if (g){
            jLabel1.setVisible(false);//if values are true,label does not display
            }
            else {
            jLabel1.setText("* Enter only characters ");//validation error displayed
            jLabel1.setVisible(true);
            jLabel1.setForeground(Color.red);
            }
            }
            });
    

    ...hope this helps :)
  3. In Topic: need to send data to dbase using a loginform

    Posted 27 Jul 2012

    sorry about that
    public void DbConnect(){
    try{
    String host="jdbc:derby://localhost:1527/ars";
    String uName="admin";
    String uPass="admin";
    conn=DriverManager.getConnection(host,uName,uPass);
    
    state=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_UPDATABLE);
    String sql="SELECT*FROM app.ARS_Reg";
    rs=state.executeQuery(sql);
    
    rs.next();
    data();
    }
    catch(SQLException err){
    JOptionPane.showMessageDialog(JRegAdmin.this, err.getMessage());
    }
    }
    


    //NEW RECORD
    private void jNewButtonActionPerformed(java.awt.event.ActionEvent evt) {
    try{
    row=rs.getRow();
    jTextField7 //to display the new auto incremented value generated from my database
    jTextField4.setText(" ");
    jTextField5.setText(" ");
    jTextField6.setText(" ");
    jTextField1.setText(" ");
    jTextField15.setText(" ");
    jTextField12.setText(" ");
    jTextField14.setText(" ");
    jButton1.setEnabled(false);
    jButton2.setEnabled(false);
    jButton3.setEnabled(false);
    jButton4.setEnabled(false);
    jButton5.setEnabled(false);
    jButton6.setEnabled(false);
    jButton8.setEnabled(false);
    jButton7.setEnabled(true);
    jButton9.setEnabled(true);
    }
    catch(SQLException err){
    JOptionPane.showMessageDialog(null,err.getMessage());
    }
    } 
    

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

Comments

reggea has no profile comments yet. Why not say hello?