tnx in advance !
3 Replies - 3540 Views - Last Post: 13 October 2010 - 11:16 AM
#1
help ! how to do a simple log in program in netbeans using java da
Posted 13 October 2010 - 08:46 AM
help ! how to do a simple log in program in netbeans using java database ?
tnx in advance !
tnx in advance !
Replies To: help ! how to do a simple log in program in netbeans using java da
#2
Re: help ! how to do a simple log in program in netbeans using java da
Posted 13 October 2010 - 08:50 AM
Moved to Java.
You should take a look at the JDBC API, as well as Swing if you want a GUI. We are happy to help you with code you wrote. Post it using code tags, along with your problems or errors.
You should take a look at the JDBC API, as well as Swing if you want a GUI. We are happy to help you with code you wrote. Post it using code tags, along with your problems or errors.
#3
Re: help ! how to do a simple log in program in netbeans using java da
Posted 13 October 2010 - 08:58 AM
macosxnerd101, on 13 October 2010 - 07:50 AM, said:
Moved to Java.
You should take a look at the JDBC API, as well as Swing if you want a GUI. We are happy to help you with code you wrote. Post it using code tags, along with your problems or errors.
You should take a look at the JDBC API, as well as Swing if you want a GUI. We are happy to help you with code you wrote. Post it using code tags, along with your problems or errors.
im a newbie in programming..i just got this code somewhere on the internet ! my problems is..only one account in my database can succesfully login even though the others are correct and truly exist !
why ?
try{
stmt =con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
String SQL = "SELECT * FROM DATOS";
rs =stmt.executeQuery( SQL );
rs.first();
while(rs.next()){
if(rs.getString("USER_ID").equals(txt1.getText())&& rs.getString("PASSCODE").equals(txt2.getText())){
JOptionPane.showMessageDialog(null, "Login Successful");
// PatientReg patient = new PatientReg();
// patient.init();
// patient.buildGUI();
// loginFrame.hide();
con.close();
rs.close();
stmt.close();
}
else{
JOptionPane.showMessageDialog(null, "Attempt failed");
System.exit(1);
}
}
}catch(SQLException e){
System.err.println(e.getMessage());
}
}
#4
Re: help ! how to do a simple log in program in netbeans using java da
Posted 13 October 2010 - 11:16 AM
Only one account should be able to login at a time on your computer. Can you login for the others when you don't have any running sessions? For security reasons, you really don't want to have three separate sessions open at once.
Also, I advise against copying code from other sources, especially when you don't feel comfortable writing the code yourself. It makes for a debugging nightmare when you come across troubles integrating it or setting it up with your other code or tools. Take some time to look at online tutorials, like the Sun tutorial, and write the code yourself. You will learn a lot more that way. If you've never written a line of code before, perhaps JDBC is a ways off. Start with the basic and introductory material, and get up to speed on that before pursuing more advanced topics.
Also, I advise against copying code from other sources, especially when you don't feel comfortable writing the code yourself. It makes for a debugging nightmare when you come across troubles integrating it or setting it up with your other code or tools. Take some time to look at online tutorials, like the Sun tutorial, and write the code yourself. You will learn a lot more that way. If you've never written a line of code before, perhaps JDBC is a ways off. Start with the basic and introductory material, and get up to speed on that before pursuing more advanced topics.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote






|