java - How to perform action on OK of JOptionPane.showMessageDialog -


i working on first desktop based java project. have 2 questions actually

1) how perform action on ok button of joptionpane.showmessagedialog.i want navigate new jframe x.java on clicking ok.

2) have table named user. table has 8 columns userid (primary key), name, password,emailid, dob, mobileno ,city, date. 4 column entries has fetched jframe x , remaining 4 other jframe y.

i wrote following code

for frame x

preparedstatement stm = con.preparestatement("insert user    (userrid,name,password,emailid))values (?,?,?,?) ");        stm.setstring(1,id); // id public variable       stm.setstring(2,name);       stm.setstring(3,ps);       stm.setstring(4,email);      stm.executeupdate(); 

and frame y. (userid primary key)

public class y extends javax.swing.jframe {       x o = new x(); // access id variable frame x  }     preparedstatement stm = con.preparestatement(" update user set  dob ='? ', mobileno  ='?' ,city='?', date='?'  userid= 'o.id' ");   

it keeps throwing exceptions above sql query

java.sql.sqlexception: parameter index out of range (1 > number of parameters, 0).

1) how perform action on ok button of joptionpane.showmessagedialog.i want navigate new jframe x.java on clicking ok.

int input = joptionpane.showoptiondialog(null, "hello world", "the title", joptionpane.ok_cancel_option, joptionpane.information_message, null, null, null);  if(input == joptionpane.ok_option) {     // } 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -