Results 1 to 2 of 2
  1. #1
    giggz is offline Member
    Join Date
    Dec 2010
    Posts
    1
    Rep Power
    0

    Default [very noob] toggle next record/previous

    hi there guys i am new to java and have 0 expirience i would like to know the code if someone could tell it me to toggle to my next rocord and once at the end of my records a message box popup with an error message ty very much here is my code.

    Java Code:
        public frmMain() {
            initComponents();
       try{
            String filename = "c:/data.accdb";
            String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ="+ filename +";";
            Connection con =DriverManager.getConnection(database,"","");
            Statement stmt = con.createStatement();
            ResultSet rs = stmt.executeQuery("select * from table1");
            while (rs.next()) {
    	jTextNickname.setText(rs.getString("Nickname"));
            jTextAge.setText(rs.getString("Age"));
            jTextComment.setText(rs.getString("Comment"));
    	}
    
            }catch (Exception e )
           {
    
                jTextError.setText("There Seems to be a Problem..");
    
            }
    
    
        }

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,337
    Blog Entries
    7
    Rep Power
    20

    Default

    Read the API documentation for the Connection interface; you should create a scrollable Statement. The way you did it the ResultSet interface can only scroll foreward.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Toggle Trobble
    By pottsmgg in forum New To Java
    Replies: 22
    Last Post: 09-20-2010, 04:25 PM
  2. Replies: 4
    Last Post: 01-04-2010, 01:23 PM
  3. [SOLVED] Toggle Mouse Left-Right Handed
    By sirwiggles in forum New To Java
    Replies: 4
    Last Post: 04-10-2009, 10:27 PM
  4. Help im a noob.. a super noob on java..
    By critdevil in forum New To Java
    Replies: 12
    Last Post: 03-07-2009, 03:17 AM
  5. Checking toggle state of a menu item
    By xsive in forum SWT / JFace
    Replies: 1
    Last Post: 09-22-2008, 02:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •