im tr table only 2 column exist , first1 time period of text type nd 2nd is rate ,i.e also text type,my code is

try  {	Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
					
Connection con=DriverManager.getConnection("jdbc:odbc:DRIVER=Microsoft Access DRIVER (*.mdb);DBQ=trrelation.mdb");
 String tp=(String)mTimePd.getElementAt(cTimePd.getSelectedIndex());
PreparedStatement ps=con.prepareStatement("select Rate from tr where TimePeriod=?");
			ResultSet  rs=ps.executeQuery();
			ps.setString(1,tp);
						
			while(rs.next()){
		     tRate.setText(rs.getString(2));
							
						
			}
		con.close();
            }
            catch(Exception ex){
            	System.out.println(ex.toString());
            }
ResultSet rs=ps.executeQuery();
ps.setString(1,tp);

Maybe you would do better with these two lines the other way round?

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.