Database Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesDatabase Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old January 8th, 2008, 09:48 AM
fr0oby fr0oby is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Location: singapore
Posts: 3 fr0oby User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 30 sec
Reputation Power: 0
Send a message via MSN to fr0oby
How to store data into database using Eclipse software

i need help on a current project..

my school need me to use the software (Eclipse) to do my project, however for the page of registration, i need to store my customers data into the database..

i need some sample codes.. who can help me please? thank you..


thanks,
fr0oby

Reply With Quote
  #2  
Old January 11th, 2008, 08:33 AM
fr0oby fr0oby is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Location: singapore
Posts: 3 fr0oby User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 30 sec
Reputation Power: 0
Send a message via MSN to fr0oby
and if u need the software can jus leave me a note.. i can either send to u or depends what u need.. i really need help urgently.. thank you..

fr0oby

Reply With Quote
  #3  
Old January 26th, 2008, 12:01 AM
fr0oby fr0oby is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Location: singapore
Posts: 3 fr0oby User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 30 sec
Reputation Power: 0
Send a message via MSN to fr0oby
i have got the answer on how to store d data already.. thank anyway for trying??


publicclass SignUpPage {
private JRadioButton jRadioButton1 = null;
import javax.swing.JButton;
private JButton getJButton1() {
if (jButton1 == null) {
jButton1 = new JButton();
jButton1.setBounds(new java.awt.Rectangle(360,496,85,30));
jButton1.setBackground(java.awt.Color.black);
jButton1.setIcon(new ImageIcon("C:/Chester/pictures/Buttons/Submit Button.jpg"));
jButton1.setText("Submit");
jButton1.addActionListener(new java.awt.event.ActionListener() {
publicvoid actionPerformed(java.awt.event.ActionEvent e) {
submitLogin(e);
}
});
}
returnjButton1;
}
publicvoid submitLogin(ActionEvent e){
String names = getJTextField().getText();
String pwd = new String(getJPasswordField().getPassword());
String id = getJTextField2().getText();
String age= getJTextField1().getText();
String securityqns = getJTextField3().getText();
String securityans = new String(getJPasswordField1().getPassword());
String gender = null;

if (jRadioButton.isSelected())
gender = jRadioButton.getText();
elseif (jRadioButton1.isSelected())
gender = jRadioButton1.getText();

System.out.println(id + " " + pwd + gender);
if (names.equals("") || pwd.equals("") || id.equals("") || gender.equals("") || securityqns.equals("") || securityans.equals(""))
JOptionPane.showMessageDialog(null, "Please enter all text field");
else{
User user = new User(names, age, gender, id, pwd, securityqns, securityans);
if (user.retrieveUser())
JOptionPane.showMessageDialog(null, "User already exists! Cannot Create.");
else{
if (user.createUser()==true);
JOptionPane.showMessageDialog(null, "You have sign up successfully!");
}
}
}






publicboolean createUser(){
boolean success = false;
DBController db = new DBController();
db.setUp("myDatabase1");
String sql = "INSERT INTO Registration(names, age, gender, id, pwd, securityquestion, securityanswer) ";
sql += "VALUES ('" + names + "','" + age + "','" + gender + "','" + id + "','" + pwd + "','" + securityquestion + "','" + securityanswer + "')";
if (db.updateRequest(sql)==1)
success = true;
db.terminate();
returnsuccess;
}


publicboolean retrieveUser(){
boolean success = false;
ResultSet rs = null;
DBController db = new DBController();
db.setUp("myDatabase1");
String dbQuery = "SELECT * FROM Registration WHERE id ='";
dbQuery += id + "'" ;
rs = db.readRequest(dbQuery);
try{
if (rs.next()){
pwd = rs.getString("pwd");
securityquestion = rs.getString("securityquestion");
securityanswer = rs.getString("securityanswer");
success = true;
}
}catch (Exception e) {
e.printStackTrace();
}
db.terminate();
return success;
}


Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesDatabase Development > How to store data into database using Eclipse software


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway