hi i am new in this and i can not solve the problem.my code is:
.......
public void actionPerformed(ActionEvent e) {
String nid = new String(t1.getText());
String name = new String(t2.getText());
String phn_no = new String(t3.getText());
String email = new String(t4.getText());
String address = new String(t5.getText());
String room_no = new String(t6.getText());
String iss_date = new String(t7.getText());
String res_days = new String(t8.getText());
String bill_paid = new String(t9.getText());
String due = new String(t10.getText());
if (e.getSource() == e1) {
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn=DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:xe","system","almaksud");
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery("INSERT INTO CUSTOMER VALUES("+nid+","+name+","+phn_no+","+email+","+address+","+room_no+","+iss_date+","+res_days+","+bill_paid+","+due+ ")");
while(rs.next())
conn.close();
}catch(Exception d){ System.out.println(e);}
................
..................
.....................
actually what i am trying to do is that i have created a frame which have 10 textfiedl they are from t1 to t2 and two button "save and exit".
......
String nid = new String(t1.getText());
String name = new String(t2.getText());
String phn_no = new String(t3.getText());
String email = new String(t4.getText());
String address = new String(t5.getText());
String room_no = new String(t6.getText());
String iss_date = new String(t7.getText());
String res_days = new String(t8.getText());
String bill_paid = new String(t9.getText());
String due = new String(t10.getText());
...............
...this part will take string value from text field and pass them to the sql query
ResultSet rs=stmt.executeQuery("INSERT INTO CUSTOMER VALUES("+nid+","+name+","+phn_no+","+email+","+address+","+room_no+","+iss_date+","+res_days+","+bill_paid+","+due+ ")");
if i click the button "save" and then the query will be executed and so every string will be saved in database.please help me.......