Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String nos =(String) t1.getText();
- String pn = (String)t2.getText();
- String ano = (String)t3.getText();
- String co =(String) t4.getText();
- String cmb= (String)cmb1.getSelectedItem();
- String dob=(String) t5.getText();
- if (opt1.isSelected()==true){
- String pm= "MBA";
- try
- {
- Class.forName("java.sql.Driver");
- Connection con=DriverManager.getConnection("jdbc:mysql://localhost/hameed","root","iis");
- Statement st=con.createStatement();
- st.executeUpdate("insert into univad values ('"+nos+"','"+pn+"','"+ano+"','"+co+"','"+cmb+"','"+dob+"','"+pm+"');");
- st.close();
- con.close();
- }
- catch(Exception e)
- {
- System.out.println("error inconnectivity");
- }
- }
- else if (opt2.isSelected()==true){
- String pm="BBA";
- try
- {
- Class.forName("java.sql.Driver");
- Connection con=DriverManager.getConnection("jdbc:mysql://localhost/hameed","root","iis");
- Statement st=con.createStatement();
- st.executeUpdate("insert into univad values ('"+nos+"','"+pn+"','"+ano+"','"+co+"','"+cmb+"','"+dob+"','"+pm+"');");
- st.close();
- con.close();
- }
- catch(Exception e)
- {
- System.out.println("error inconnectivity");
- }
- try
- {
- Class.forName("java.sql.Driver");
- Connection con=DriverManager.getConnection("jdbc:mysql://localhost/hameed","root","iis");
- Statement st=con.createStatement();
- st.executeUpdate("insert into univad values ('"+nos+"','"+pn+"','"+ano+"','"+co+"','"+cmb+"','"+dob+"','"+pm+"');");
- st.close();
- con.close();
- }
- catch(Exception e)
- {
- System.out.println("error inconnectivity");
- }
- }
- else if (opt3.isSelected()==true){
- String pm="ELECTRICAL ENGINEERING";
- try
- {
- Class.forName("java.sql.Driver");
- Connection con=DriverManager.getConnection("jdbc:mysql://localhost/hameed","root","iis");
- Statement st=con.createStatement();
- st.executeUpdate("insert into univad values ('"+nos+"','"+pn+"','"+ano+"','"+co+"','"+cmb+"','"+dob+"','"+pm+"');");
- st.close();
- con.close();
- }
- catch(Exception e)
- {
- System.out.println("error inconnectivity");
- }
- }
- }
Add Comment
Please, Sign In to add comment