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 2 of 2

Thread: Help with java retrieving from Ms Access

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

    Default Help with java retrieving from Ms Access

    i have encountered problem when trying to retrieve the score from my database and there seems to be something wrong with my sql statement. can someone help me check the codes? the table is named Table1 and consist of the column number, NameParticipant and Score.

    private void results()
    {
    	try
    	{
    		if(rs == null)
    		{
    			Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    			Connection con = DriverManager.getConnection("jdbc:odbc:tips");
    			String sql = "Select NameParticipant from Table1 ORDER BY Score DESC LIMIT 1 ";
    			Statement statement = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
    			rs = statement.executeQuery(sql);	
    			addtolabel();
    		}
     
     
     
    	}
    	catch(Exception e)
    	{
    		e.printStackTrace();
    	}
     
    }
     
     
    private void addtolabel()
    {
    	try{
    		label91.setText(rs.getString("tips"));
     
     
     
     
    	}
    	catch(SQLException e)
    	{
    		e.printStackTrace();
    	}
    }
    }


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Help with java retrieving from Ms Access

    and there seems to be something wrong with my sql statement
    What do you mean something wrong? Is an exception thrown? If so, post the exception...what does it tell you?

Similar Threads

  1. SNMP help retrieving OID
    By kurt-hardy in forum Java Theory & Questions
    Replies: 0
    Last Post: November 18th, 2010, 04:39 AM
  2. Some information on retrieving packets
    By Cheetah in forum Java Networking
    Replies: 0
    Last Post: July 11th, 2010, 08:43 PM
  3. How do I access SENS information in JAVA?
    By cabodge in forum Java Theory & Questions
    Replies: 4
    Last Post: March 9th, 2010, 06:52 PM
  4. Default Access (package access) confusion
    By gauravrajbehl in forum Java Theory & Questions
    Replies: 1
    Last Post: November 18th, 2009, 04:11 AM
  5. problem in retrieving data via RMS
    By solaleh in forum Java ME (Mobile Edition)
    Replies: 0
    Last Post: August 30th, 2009, 05:46 AM