Hi. Sorry if such a question was asked before. I am coding an application for entering child patient details as registration. The basic details were entered in a previous form. Now i am adding the diagnosis. here i have a problem. i require that when i type the id into a text box and press search another textbox should return the associated name. i got code for it but it doesn't work here is the code i used
try{ Class.forName("com.mysql.jdbc.Driver"); Connection conn = DriverManager.getConnection( "jdbc:mysql://localhost/autmgt","root","pass"); Statement st = conn.createStatement(); ResultSet rs=null; String pval1=text1.getText(); String SQL="select * from child where CID="+"'"+pval1+"'"; rs=st.executeQuery(SQL); String k=rs.getString("CName"); text2.setText(k); }catch(Exception e){}
TIA