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
.....................................................................................................................................

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();
}
}

......................................................................................................................................

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.

And what are you trying to accomplish by doing this:

jl1=new JLabel("<html><center><font face=Maiandra GD size=5><u>Welcome to</u><p>School Management System</font></html>");
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.