Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: java.sql.SQLException: No data found

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default java.sql.SQLException: No data found

    [Qouta=Java]

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.sql.*;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.Statement;

    public class myproject implements ActionListener
    {
    JFrame f;
    JPanel pan;
    TextField usname,pas;
    JButton login;
    JLabel l1,l2,inf;

    public myproject()
    {
    f=new JFrame("login page");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setSize(800,800);
    pan=new JPanel();
    f.add(pan);
    pan.setBackground(Color.magenta);
    usname=new TextField("",14);
    pas=new TextField("",14);
    pas.setEchoChar('*');
    l1=new JLabel("Username");
    l2=new JLabel("Password");
    inf=new JLabel("login information");
    login=new JButton("Submit");
    pan.setLayout(null);
    inf.setBounds(300,150,200,30);
    l1.setBounds(250,200,100,30);
    usname.setBounds(400,200,150,30);
    l2.setBounds(250,250,100,30);
    pas.setBounds(400,250,150,30);
    login.setBounds(350,300,100,30);
    pan.add(inf);
    pan.add(l1);
    pan.add(usname);
    pan.add(l2);
    pan.add(pas);
    pan.add(login);
    f.setVisible(true);
    login.addActionListener(this);
    }
    public void actionPerformed(ActionEvent ae)
    {
    String str=ae.getActionCommand();
    String name=usname.getText();
    String word=pas.getText();
    if(str.equals("Submit")&& name.equals("virender")&& word.equals("kumar"))
    {
    f.setVisible(false);
    option o1=new option();
    }
    else
    {
    JOptionPane.showMessageDialog(null,"Please check your username & password","Login error",JOptionPane.PLAIN_MESSAGE);

    }
    }
    public static void main(String arg[])
    {
    myproject p1=new myproject();

    }
    }
    class option implements ActionListener
    {
    JFrame f1;
    JPanel pan1;
    JButton add,updte,delt,back,srh;
    JLabel l3,l4,l5,lbl,search;
    Font fo,fo1;
    public option()
    {
    f1=new JFrame("choice page");
    f1.setSize(800,800);
    pan1=new JPanel();
    f1.add(pan1);
    pan1.setBackground(Color.magenta);
    pan1.setLayout(null);
    lbl=new JLabel("click on choice");
    l3=new JLabel("To Add Student Information" );
    l4=new JLabel("To Update Student Information");
    l5=new JLabel("To Delete Student Information");
    search=new JLabel("To Search Student Information");
    add=new JButton("Add");
    updte=new JButton("Update");
    delt=new JButton("Delete");
    back=new JButton("Logout");
    srh=new JButton("Search");
    lbl.setBounds(250,150,400,30);
    l3.setBounds(150,250,300,30);
    l4.setBounds(150,300,300,30);
    l5.setBounds(150,350,300,30);
    search.setBounds(150,400,300,30);
    add.setBounds(450,250,100,30);
    updte.setBounds(450,300,100,30);
    delt.setBounds(450,350,100,30);
    srh.setBounds(450,400,100,30);
    back.setBounds(300,500,100,30);
    fo=new Font("Comic Sans",Font.BOLD|Font.ITALIC,34);
    fo1=new Font("Comic Sans",Font.BOLD|Font.ITALIC,18);
    l3.setFont(fo1);
    l4.setFont(fo1);
    l5.setFont(fo1);
    search.setFont(fo1);
    lbl.setFont(fo);
    pan1.add(lbl);
    pan1.add(l3);
    pan1.add(add);
    pan1.add(l4);
    pan1.add(updte);
    pan1.add(l5);
    pan1.add(delt);
    pan1.add(search);
    pan1.add(srh);
    pan1.add(back);
    f1.setVisible(true);
    back.addActionListener(this);
    add.addActionListener(this);
    updte.addActionListener(this);
    delt.addActionListener(this);
    srh.addActionListener(this);
    }
    public void actionPerformed(ActionEvent ae)
    {
    String str=ae.getActionCommand();
    if(str.equals("Logout"))
    {
    f1.setVisible(false);
    myproject p2=new myproject();

    }
    if(str.equals("Add"))
    {
    f1.setVisible(false);
    information1 obj=new information1();

    }
    if(str.equals("Update"))
    {
    f1.setVisible(false);
    ucbox obj=new ucbox();

    }
    if(str.equals("Search"))
    {
    f1.setVisible(false);
    scbox obj=new scbox();

    }
    if(str.equals("Delete"))
    {
    f1.setVisible(false);

    dcbox obj=new dcbox();

    }
    }
    }
    class information1 implements ActionListener {
    static int Comp=1105101;
    static int It=1105201;
    static int Ece=1105301;
    static int Mech=1105401;
    static int Instru=1105501;
    static int Elect=1105601;
    static int Civil=1105701;
    JFrame f2;
    JPanel pan2;
    TextField fname,lname,pno,eid;
    JTextArea addr;
    JButton str,rest,bck;
    JLabel stu,fn,ln,ad,ph,ed;
    JLabel slct,dob;
    JComboBox brch,dt,mnth,yr;
    String brnch[]={"IT","computer","Electrical","Mechanical","civil "};
    String date[]={"1","2","3","4","5","6","7","8","9","10","11","1 4","13","14","15","16","17","18","19","20","21","2 2","23","24","25","26","27","28","29","30","31" };
    String month[]={"jan","feb","march","Arpil","May","June","July", "August","September","october","november","Decembe r"};
    String year[]={"1980","1981","1982","1983","1984","1985","1986" ,"1987","1988","1989","1990","1991","1992","1993", "1994","1995","1996","1997","1998","1999","200 0"};
    Font fo,fo1;
    public information1()
    {

    f2=new JFrame("Student Information");
    f2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f2.setSize(800,800);
    pan2=new JPanel();
    pan2.setLayout(null);
    f2.add(pan2);
    pan2.setBackground(Color.magenta);
    fname=new TextField("",14);
    lname=new TextField("",14);
    pno=new TextField("",14);
    eid=new TextField("",30);
    addr=new JTextArea(30,90);
    stu=new JLabel("Enter the Student Information");
    fn=new JLabel("First name");
    ln=new JLabel("Last name");
    ad=new JLabel("Address");
    ph=new JLabel("Phone no");
    ed=new JLabel("Email_id");
    str=new JButton("ADD");
    rest=new JButton("Reset");
    bck=new JButton("Back");
    slct=new JLabel("Select Branch");
    dob=new JLabel("D.O.B");
    brch=new JComboBox(brnch);
    dt=new JComboBox(date);
    mnth=new JComboBox(month);
    slct=new JLabel("Select Branch");
    dob=new JLabel("D.O.B");
    brch=new JComboBox(brnch);
    dt=new JComboBox(date);
    mnth=new JComboBox(month);
    yr=new JComboBox(year);
    fo=new Font("Comic Sans",Font.BOLD|Font.ITALIC,30);
    fo1=new Font("Comic Sans",Font.BOLD|Font.ITALIC,15);
    stu.setFont(fo);
    fn.setFont(fo1);
    ln.setFont(fo1);
    ad.setFont(fo1);
    ph.setFont(fo1);
    ed.setFont(fo1);
    stu.setBounds(150,50,500,50);
    fn.setBounds(100,200,150,30);
    ln.setBounds(100,250,150,30);
    dob.setBounds(100,300,150,30);
    slct.setBounds(100,350,150,30);
    ad.setBounds(100,400,150,30);
    ph.setBounds(100,530,150,30);
    ed.setBounds(100,580,150,30);
    fname.setBounds(300,200,150,30);
    lname.setBounds(300,250,150,30);
    dt.setBounds(300,300,70,30);
    mnth.setBounds(400,300,100,30);
    yr.setBounds(530,300,100,30);
    brch.setBounds(300,350,200,30);
    addr.setBounds(300,400,200,80);
    pno.setBounds(300,530,150,30);
    eid.setBounds(300,580,150,30);
    str.setBounds(100,630,150,30);
    rest.setBounds(300,630,150,30);
    bck.setBounds(500,630,150,30);
    pan2.add(stu);
    pan2.add(fn);
    pan2.add(fname);
    pan2.add(ln);
    pan2.add(lname);
    pan2.add(ad);
    pan2.add(addr);
    pan2.add(ph);
    pan2.add(pno);
    pan2.add(ed);
    pan2.add(eid);
    pan2.add(slct);
    pan2.add(brch);
    pan2.add(dob);
    pan2.add(dt);
    pan2.add(mnth);
    pan2.add(yr);
    pan2.add(str);
    pan2.add(rest);
    pan2.add(bck);
    bck.addActionListener(this);
    str.addActionListener(this);
    rest.addActionListener(this);
    f2.setVisible(true);
    }
    public void actionPerformed(ActionEvent ae1)
    {

    String str1=ae1.getActionCommand();
    if(str1.equals("Back"))
    {
    f2.setVisible(false);
    option o2=new option();

    }
    if(str1.equals("Reset"))
    {
    fname.setText("");
    lname.setText("");
    pno.setText("");
    eid.setText("");
    addr.setText("");

    }
    if(str1.equals("ADD"))
    {

    String fstname=fname.getText();
    String lstname=lname.getText();
    String phno=pno.getText();
    String eml=eid.getText();
    String trd=(String)brch.getSelectedItem();
    String date=(String)dt.getSelectedItem();
    String month=(String)mnth.getSelectedItem();
    String year=(String)yr.getSelectedItem();
    String adrs=addr.getText();
    if(fstname.equals("")||lstname.equals("")||phno.eq uals("")||adrs.equals(""))
    {
    JOptionPane.showMessageDialog(null,"Enter complete information ","Error",JOptionPane.PLAIN_MESSAGE);
    }
    else
    {
    try
    {

    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("Jdbc:Odbc:student ","","");
    Statement st=con.createStatement(ResultSet.TYPE_SCROLL_SENSI TIVE,ResultSet.CONCUR_UPDATABLE);
    ResultSet res=st.executeQuery("select * from "+trd);
    if(res.next())
    {
    res.last();
    int c=res.getInt("rollno");
    if(c==0)
    {
    }
    else
    {
    if(trd.equals("computer"))
    Comp=c+1;
    if(trd.equals("civil"))
    Civil=c+1;
    if(trd.equals("Electrical"))
    Elect=c+1;
    if(trd.equals("IT"))
    It=c+1;
    if(trd.equals("Mechanical"))
    Mech=c+1;
    }
    }

    PreparedStatement ps=con.prepareStatement("insert into "+trd+" (rollno,firstname,lastname,dob,address,email,phone no) values(?,?,?,?,?,?,?)");


    if(trd.equals("computer"))
    ps.setInt(1,Comp);
    if(trd.equals("civil"))
    ps.setInt(1,Civil);
    if(trd.equals("Electrical"))
    ps.setInt(1,Elect);
    if(trd.equals("IT"))
    ps.setInt(1,It);
    if(trd.equals("Mechanical"))
    ps.setInt(1,Mech);
    ps.setString(2,fstname);
    ps.setString(3,lstname);
    ps.setString(4,date+month+year);
    ps.setString(5,adrs);
    ps.setString(6,eml);
    ps.setString(7,phno);
    ps.executeUpdate();
    PreparedStatement ps1=con.prepareStatement("select rollno from "+trd+" where phoneno=?");
    ps1.setString(1,phno);
    ResultSet rs1=ps1.executeQuery();

    if(rs1.next())
    {

    JOptionPane.showMessageDialog(null,"Roll of student is "+rs1.getInt("rollno")+"\n Registration Successfull","Roll_no",JOptionPane.PLAIN_MESSAGE);
    }
    fname.setText("");
    lname.setText("");
    pno.setText("");
    eid.setText("");
    addr.setText("");
    con.close();
    Comp++;
    It++;
    Mech++;
    Instru++;
    Civil++;
    Ece++;
    Elect++;
    }

    catch(Exception e)
    {

    System.out.println(e);
    }


    }
    }

    }

    }

    class ucbox implements ActionListener{
    JFrame f4;
    JPanel pan4;
    JLabel slct,roll;
    JTextField rno;
    JComboBox brch;
    JButton go,back;
    String brnch[]={"IT","computer","Electrical","Mechanical","civil "};
    public ucbox()
    {
    f4=new JFrame("select");
    f4.setSize(800,800);
    pan4=new JPanel();
    f4.add(pan4);
    pan4.setBackground(Color.magenta);
    pan4.setLayout(null);
    slct=new JLabel("Select Branch");
    roll=new JLabel("Enter roll_no");
    brch=new JComboBox(brnch);
    go=new JButton("Next");
    back=new JButton("Back");
    rno=new JTextField("",14);
    slct.setBounds(200,150,150,30);
    brch.setBounds(400,150,150,30);
    roll.setBounds(200,200,150,30);
    rno.setBounds(400,200,150,30);
    go.setBounds(300,280,150,30);
    back.setBounds(300,360,150,30);
    pan4.add(slct);
    pan4.add(brch);
    pan4.add(go);
    pan4.add(back);
    pan4.add(roll);
    pan4.add(rno);
    f4.setVisible(true);
    go.addActionListener(this);
    back.addActionListener(this);
    }
    public void actionPerformed(ActionEvent ae)
    {
    String str=ae.getActionCommand();
    if(str.equals("Back"))
    {
    f4.setVisible(false);
    option o1=new option();
    }
    if(str.equals("Next"))
    {
    f4.setVisible(false);
    updt u1=new updt((String)brch.getSelectedItem(),(String)rno.ge tText());
    JOptionPane.showMessageDialog(null,"Data cant be Updated","Update",JOptionPane.PLAIN_MESSAGE);
    }
    }
    }
    class dcbox implements ActionListener{
    JFrame f4;
    JPanel pan4;
    JLabel slct,roll;
    JTextField rno;
    JComboBox brch;
    JButton go,back;
    String brnch[]={"IT","computer","Electrical","Mechanical","civil "};
    public dcbox()
    {
    f4=new JFrame("select");
    f4.setSize(800,800);
    pan4=new JPanel();
    f4.add(pan4);
    pan4.setBackground(Color.magenta);
    pan4.setLayout(null);
    slct=new JLabel("Select Branch");
    roll=new JLabel("Enter roll_no");
    brch=new JComboBox(brnch);
    go=new JButton("Delete");
    back=new JButton("Back");
    rno=new JTextField("",14);
    slct.setBounds(200,150,150,30);
    brch.setBounds(400,150,150,30);
    roll.setBounds(200,200,150,30);
    rno.setBounds(400,200,150,30);
    go.setBounds(300,280,150,30);
    back.setBounds(300,360,150,30);
    pan4.add(slct);
    pan4.add(brch);
    pan4.add(go);
    pan4.add(back);
    pan4.add(roll);
    pan4.add(rno);
    f4.setVisible(true);
    go.addActionListener(this);
    back.addActionListener(this);
    }
    public void actionPerformed(ActionEvent ae)


    {
    int x;
    x=0;
    String str=ae.getActionCommand();
    if(str.equals("Back"))
    {
    f4.setVisible(false);
    option o1=new option();
    }
    if(str.equals("Delete"))
    {
    String rno1=rno.getText();
    String trd=(String)brch.getSelectedItem();
    try
    {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbcdbc:student","","");
    PreparedStatement ps1=con.prepareStatement("delete * from "+trd+" where rollno=?");
    ps1.setString(1,rno1);
    int i=ps1.executeUpdate();
    if(i!=0)
    {


    JOptionPane.showMessageDialog(null,"Information Deleted","Delete",JOptionPane.PLAIN_MESSAGE);
    }
    else
    {
    JOptionPane.showMessageDialog(null,"Deletion Faliure","Delete",JOptionPane.PLAIN_MESSAGE);
    }



    con.close();
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog(null,"Deletion Faliure","Delete",JOptionPane.PLAIN_MESSAGE);
    System.out.println(e);
    }
    }
    }
    }

    class scbox implements ActionListener{
    JFrame f4;
    JPanel pan4;
    JLabel slct,roll;
    JTextField rno;
    JComboBox brch;
    JButton go,back;
    String brnch[]={"IT","computer","Electrical","Mechanical","civil "};
    public scbox()
    {
    f4=new JFrame("select");
    f4.setSize(800,800);
    pan4=new JPanel();
    f4.add(pan4);
    pan4.setBackground(Color.magenta);
    pan4.setLayout(null);
    slct=new JLabel("Select Branch");
    roll=new JLabel("Enter roll_no");
    brch=new JComboBox(brnch);
    go=new JButton("Search");
    back=new JButton("Back");
    rno=new JTextField("",14);
    slct.setBounds(200,150,150,30);
    brch.setBounds(400,150,150,30);
    roll.setBounds(200,200,150,30);
    rno.setBounds(400,200,150,30);
    go.setBounds(300,280,150,30);
    back.setBounds(300,360,150,30);
    pan4.add(slct);
    pan4.add(brch);
    pan4.add(go);
    pan4.add(back);
    pan4.add(roll);
    pan4.add(rno);
    f4.setVisible(true);
    go.addActionListener(this);
    back.addActionListener(this);
    }
    public void actionPerformed(ActionEvent ae)
    {
    String str=ae.getActionCommand();
    if(str.equals("Back"))
    {
    f4.setVisible(false);
    option o1=new option();
    }
    if(str.equals("Search"))
    {

    String rno1=rno.getText();
    String trd=(String)brch.getSelectedItem();
    try
    {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbcdbc:student","","");
    PreparedStatement ps1=con.prepareStatement("select * from "+trd+" where rollno=?");
    ps1.setString(1,rno1);
    ResultSet rs1=ps1.executeQuery();
    if(rs1.next())
    {

    JOptionPane.showMessageDialog(null,"First name of student is "+rs1.getString("firstname")+"\nLast name of student is "+rs1.getString("lastname")+"\nDate of Birth of student is :"+rs1.getString("dob")+"\nAddress of student is: "+rs1.getString("address")+"\nEmail ID of student is :"+rs1.getString("email")+"\nPhone no of student is "+rs1.getString("phoneno"),"Search",JOptionPane.PL AIN_MESSAGE);
    }
    else
    {
    JOptionPane.showMessageDialog(null,"Unregistered Entry","Search",JOptionPane.PLAIN_MESSAGE);
    }


    con.close();
    }
    catch(Exception e)
    {
    System.out.println(e);
    }
    }

    }
    }
    class updt implements ActionListener {
    String branch;
    int rollnumber;
    JFrame f2;
    JPanel pan2;
    TextField fname,lname,pno,eid;
    JTextArea addr;
    JButton str,rest,bck;
    JLabel stu,fn,ln,ad,ph,ed;
    JLabel dob;
    JComboBox dt,mnth,yr;
    String date[]={"1","2","3","4","5","6","7","8","9","10","11","1 4","13","14","15","16","17","18","19","20","21","2 2","23","24","25","26","27","28","29","30","31" };
    String month[]={"jan","feb","march","Arpil","May","June","July", "August","September","october","november","Decembe r"};
    String year[]={"1980","1981","1982","1983","1984","1985","1986" ,"1987","1988","1989","1990","1991","1992","1993", "1994","1995","1996","1997","1998","1999","200 0"};
    Font fo,fo1;
    public updt(String brch,String rnumber)
    {
    rollnumber=Integer.parseInt(rnumber);
    branch=brch;
    f2=new JFrame("New Information");
    f2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f2.setSize(800,800);
    pan2=new JPanel();
    pan2.setLayout(null);
    f2.add(pan2);
    pan2.setBackground(Color.magenta);
    fname=new TextField("",14);
    lname=new TextField("",14);
    pno=new TextField("",14);
    eid=new TextField("",30);
    addr=new JTextArea(30,90);
    stu=new JLabel("Enter the New Information");
    fn=new JLabel("First name");
    ln=new JLabel("Last name");
    ad=new JLabel("Address");
    ph=new JLabel("Phone no");
    ed=new JLabel("Email_id");
    str=new JButton("Update");
    rest=new JButton("Reset");
    bck=new JButton("Back");
    dob=new JLabel("D.O.B");
    dt=new JComboBox(date);
    mnth=new JComboBox(month);
    dob=new JLabel("D.O.B");
    dt=new JComboBox(date);
    mnth=new JComboBox(month);
    yr=new JComboBox(year);
    fo=new Font("Comic Sans",Font.BOLD|Font.ITALIC,30);
    fo1=new Font("Comic Sans",Font.BOLD|Font.ITALIC,15);
    stu.setFont(fo);
    fn.setFont(fo1);
    ln.setFont(fo1);
    ad.setFont(fo1);
    ph.setFont(fo1);
    ed.setFont(fo1);
    stu.setBounds(150,50,500,50);
    fn.setBounds(100,200,150,30);
    ln.setBounds(100,250,150,30);
    dob.setBounds(100,300,150,30);
    ad.setBounds(100,400,150,30);
    ph.setBounds(100,530,150,30);
    ed.setBounds(100,580,150,30);
    fname.setBounds(300,200,150,30);
    lname.setBounds(300,250,150,30);
    dt.setBounds(300,300,70,30);
    mnth.setBounds(400,300,100,30);
    yr.setBounds(530,300,100,30);
    addr.setBounds(300,400,200,80);
    pno.setBounds(300,530,150,30);
    eid.setBounds(300,580,150,30);
    str.setBounds(100,630,150,30);

    rest.setBounds(300,630,150,30);
    bck.setBounds(500,630,150,30);
    pan2.add(stu);
    pan2.add(fn);
    pan2.add(fname);
    pan2.add(ln);
    pan2.add(lname);
    pan2.add(ad);
    pan2.add(addr);
    pan2.add(ph);
    pan2.add(pno);
    pan2.add(ed);
    pan2.add(eid);
    pan2.add(dob);
    pan2.add(dt);
    pan2.add(mnth);
    pan2.add(yr);
    pan2.add(str);
    pan2.add(rest);
    pan2.add(bck);
    bck.addActionListener(this);
    str.addActionListener(this);
    rest.addActionListener(this);
    f2.setVisible(true);
    }
    public void actionPerformed(ActionEvent ae1)
    {

    String str1=ae1.getActionCommand();
    if(str1.equals("Back"))
    {
    f2.setVisible(false);
    ucbox o2=new ucbox();
    }
    if(str1.equals("Reset"))
    {
    fname.setText("");
    lname.setText("");
    pno.setText("");
    eid.setText("");
    addr.setText("");

    }
    if(str1.equals("Update"))
    {
    String fstname=fname.getText();
    String lstname=lname.getText();
    String phno=pno.getText();
    String eml=eid.getText();
    String date=(String)dt.getSelectedItem();
    String month=(String)mnth.getSelectedItem();
    String year=(String)yr.getSelectedItem();
    String adrs=addr.getText();
    if(fstname.equals("")||lstname.equals("")||phno.eq uals("")||adrs.equals(""))
    {
    JOptionPane.showMessageDialog(null,"Enter complete information ","Error",JOptionPane.PLAIN_MESSAGE);
    }
    else
    {
    try
    {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbcdbc:student","","");
    PreparedStatement ps=con.prepareStatement("update "+branch+" set firstname=? where rollno=?");
    ps.setString(1,fstname);
    ps.setInt(2,rollnumber);
    int p=ps.executeUpdate();
    ps=con.prepareStatement("update "+branch+" set lastname=? where rollno=?");
    ps.setString(1,lstname);
    ps.setInt(2,rollnumber);
    p=ps.executeUpdate();

    ps=con.prepareStatement("update "+branch+" set dob=? where rollno=?");
    ps.setString(1,date+month+year);
    ps.setInt(2,rollnumber);
    p=ps.executeUpdate();

    ps=con.prepareStatement("update "+branch+" set address=? where rollno=?");
    ps.setString(1,adrs);
    ps.setInt(2,rollnumber);
    p=ps.executeUpdate();

    ps=con.prepareStatement("update "+branch+" set email=? where rollno=?");
    ps.setString(1,eml);
    ps.setInt(2,rollnumber);
    p=ps.executeUpdate();

    ps=con.prepareStatement("update "+branch+" set phoneno=? where rollno=?");
    ps.setString(1,phno);
    ps.setInt(2,rollnumber);
    p=ps.executeUpdate();

    if(p!=0)
    {

    JOptionPane.showMessageDialog(null,"Informationn Updated ","Updation",JOptionPane.PLAIN_MESSAGE);
    }
    else
    {
    JOptionPane.showMessageDialog(null,"Input Type ERROR\nEnter Roll_no Again & Continue....","Informattion Error",JOptionPane.PLAIN_MESSAGE);
    }
    fname.setText("");
    lname.setText("");
    pno.setText("");
    eid.setText("");
    addr.setText("");

    con.close();

    }


    catch(Exception e)
    {

    System.out.println(e);
    }


    }
    }
    }
    }





    [Qouta]
    Attached Files Attached Files


  2. #2
    Member
    Join Date
    Oct 2011
    Posts
    42
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default Re: java.sql.SQLException: No data found

    Hi, I cannot help you with the badly formatted code and no specific question/problem described.
    Please ask in some way that others can help you quickly.

    java exception
    Last edited by hns1984; January 11th, 2012 at 06:50 PM.

  3. #3
    Junior Member
    Join Date
    Dec 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: java.sql.SQLException: No data found

    Provide the full printStackTrace(), then we can help you out

Similar Threads

  1. [SOLVED] JDBC_Servlet: Data not found
    By mithcool in forum Java Servlet
    Replies: 4
    Last Post: June 24th, 2011, 12:36 PM
  2. no data found ms -access sql exception
    By jatinrai199 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: February 16th, 2011, 03:22 PM
  3. Replies: 0
    Last Post: December 18th, 2010, 08:08 AM
  4. Replies: 6
    Last Post: August 18th, 2010, 06:41 PM
  5. Replies: 6
    Last Post: August 30th, 2009, 05:31 AM

Tags for this Thread