package OAD; import OAD.*; import java.sql.*; public class lugeja{ public String populateOptions(String tabel, String user, String pass){ Connection cn; Statement st; ResultSet rs; String tagasi=""; try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); cn=DriverManager.getConnection("jdbc:odbc:plaadikogu", user, pass); st=cn.createStatement(); }catch(Exception e){return "Tekkis viga: "+e;} try{ st=cn.createStatement(); String lause="SELECT * FROM "+tabel; rs=st.executeQuery(lause); while(rs.next()!=false){ tagasi=tagasi.concat(""); } }catch(Exception e){return "Tekkis viga: "+e;} try{cn.close();}catch(Exception e){return "Tekkis viga: "+e;} return tagasi; } public String populateChangeForm(String tabel, String esit, String user, String pass){ Connection cn; Statement st; ResultSet rs; ResultSetMetaData rsmd; String tagasi=""; try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); cn=DriverManager.getConnection("jdbc:odbc:plaadikogu", user, pass); st=cn.createStatement(); }catch(Exception e){return "Tekkis viga: "+e;} try{ st=cn.createStatement(); String lause="SELECT * FROM "+tabel+" WHERE ID="+esit; rs=st.executeQuery(lause); rs.next(); rsmd=rs.getMetaData(); tagasi="
"); }catch(Exception e){return "Tekkis viga: "+e;} try{cn.close();}catch(Exception e){return "Tekkis viga: "+e;} return tagasi; } }