| | |
urgently need help
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jan 2009
Posts: 1
Reputation:
Solved Threads: 0
actualy i need help
i m making a software in java swing
i hv a problem in retriving values from database in JTable,
i m inserting values in database ms access it works,
following is my code one is for database another one for table
.....................................................................................................................................
......................................................................................................................................
i m making a software in java swing
i hv a problem in retriving values from database in JTable,
i m inserting values in database ms access it works,
following is my code one is for database another one for table
.....................................................................................................................................
Java Syntax (Toggle Plain Text)
import java.sql.*; public class JDta { public void putting(String x,String y) { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:pproject","",""); PreparedStatement stmt=con.prepareStatement("insert into data values(?,?)"); stmt.setString(1,x); stmt.setString(2,y); stmt.executeUpdate(); stmt.close(); con.close(); } catch(Exception er) { } } public boolean checking(String x,String y) { int coun=0; boolean bb; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:exams","",""); PreparedStatement stmt=con.prepareStatement("select * from data where name=? and pass=?"); stmt.setString(1,x); stmt.setString(2,y); ResultSet rs=stmt.executeQuery(); while(rs.next()) { coun++; } stmt.close(); con.close(); } catch(Exception er) { } if(coun>0) bb=true; else bb=false; return bb; } } ...................................................................................................................................... import javax.swing.*; import java.awt.*; import java.awt.event.*; class Logger extends JFrame implements ActionListener { JButton jb1,jb2; JLabel jl1,jl2,jl3; JTextField jtf; JPasswordField jp; String x; String y; public Logger() { jl1=new JLabel("<html><center><font face=Maiandra GD size=5><u>Welcome to</u><p>School Management System</font></html>"); Container cont=getContentPane(); jl2=new JLabel("Enter Name"); jl3=new JLabel("Enter Password"); JPanel jpp=new JPanel(); jpp.setLayout(null); jtf=new JTextField(10); jp=new JPasswordField(10); jpp.add(jl1); jpp.add(jl2); jpp.add(jl3); jpp.add(jtf); jpp.add(jp); jb1=new JButton("Save"); jb1.addActionListener(this); jpp.add(jb1); jl1.setBounds(80,5,300,80); jl2.setBounds(100,75,120,10); jl3.setBounds(100,78,300,80); jtf.setBounds(205,75,120,20); jp.setBounds(205,105,120,20); jb1.setBounds(205,135,70,29); cont.add(jpp); setTitle("Log In"); setSize(500,200); setVisible(true); } public void actionPerformed(ActionEvent ae) { x=jtf.getText(); y=jp.getText(); JDta jxy=new JDta(); jxy.putting(x,y); dispose(); } public static void main(String aa[]) { new Logger(); } }
Last edited by ~s.o.s~; Jan 16th, 2009 at 3:51 am. Reason: Added code tags, learn to use them.
Would you mind helping us help you by helping yourself to this announcement at the top of the forum regarding the use of code tags and Oh Yes !!! in the mean time also describe what is actually going wrong.
Last edited by stephen84s; Jan 16th, 2009 at 3:49 am.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
"How to ask questions the smart way ?"
"How to ask questions the smart way ?"
And what are you trying to accomplish by doing this:
Java Syntax (Toggle Plain Text)
jl1=new JLabel("<html><center><font face=Maiandra GD size=5><u>Welcome to</u><p>School Management System</font></html>");
Check out my New Bike at my Public Profile at the "About Me" tab
![]() |
Similar Threads
- I need .NET basic interview questions urgently (C#)
- urgently need help.....pliz... (PHP)
- C++ Assignment NEED HELP URGENTLY (C++)
- is it possible to save a visual basic form in jpeg format??? pls help... urgently... (Visual Basic 4 / 5 / 6)
- Help Needed Urgently With Coding (Java)
Other Threads in the Java Forum
- Previous Thread: Data Structures ebooks
- Next Thread: need help.....
| Thread Tools | Search this Thread |
2dgraphics android api apple applet application arguments array arrays automation banking binary binarytree bluetooth capture chat chatprogramusingobjects class classes client code color component count database derby design eclipse eclipsedevelopment encryption error event exception fractal game givemetehcodez graphics gridlayout gui html ide if_statement image input integer interface j2me java javadesktopapplications javaprojects jlabel jni jpanel julia keyword linux list loop macintosh map method methods midlethttpconnection mobile netbeans newbie object os print printing problem producer program programming project projectideas read recursion reference replaysolutions ria scanner screen server set size sms sort sourcelabs sql stop string swing threads transforms tree ui unicode validation windows






