-1
public DialogTambah(JFrame parent, String ACTION, String NAMA) throws Exception {

    super((Frame)null,"" , true);        
    initComponents();       

    AKSI_SELANJUTNYA = ACTION;
    sId = "";
    sUserid = "";
    sPwd = "";
    sNama = "";
    sPhoneNo = "";
    sAddress = "";
    sEmail = "";
    sCrnumber = "";
    tgl="";
    if (AKSI_SELANJUTNYA == "Form Ubah") {

        try {
            Statement Update_st = DBConn.conn.createStatement();
            String SQLEdit = "select * from content where name = '" + NAMA + "' ";
            ResultSet rs = Update_st.executeQuery(SQLEdit);
            rs.next();

java.sql.SQLException: Illegal operation on empty result set.

null

myqstn why always get null result? i've checked and no bugs.

  • 3
    `if (AKSI_SELANJUTNYA == "Form Ubah")` .. Aouch !! Don't compare content of Strings using `==`. Use `equals()` instead. – Alexis C. Nov 13 '13 at 18:17
  • possible duplicate of [How do I compare strings in Java?](http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java) – Sotirios Delimanolis Nov 13 '13 at 18:18
  • The exception says it all: your result set is empty. Run this `SELECT` statement through an SQL program and see if you get any results there. – musical_coder Nov 13 '13 at 18:21

1 Answers1

0

I'm guessing "select * from content where name = '" + NAMA + "' "; returns no rows ....

What line does the exception occur on?

DaveH
  • 7,187
  • 5
  • 32
  • 53