mysql - java - validate database with an array and execute after that -
i have code code show joptionpane "ga kenek" on second array
int rows = jtable1.getrowcount(); (int = 0; < rows; a++) { string namaop = jtable1.getvalueat(a, 0).tostring(); string tgl = jtable1.getvalueat(a, 1).tostring(); string pn = jtable1.getvalueat(a, 2).tostring(); string nama = jtable1.getvalueat(a, 3).tostring(); string sql = "insert `tbl_coba`(`a`, `b`, `c`,`d`)" + " values ('" + namaop + "','" + tgl + "','" + pn + "','"+nama+"')"; string sql1="select `tbl_coba`"; try { statement st=con.createstatement(); resultset rs=st.executequery(sql1); if (rs.next()) { statement st1=con.createstatement(); if (namaop.equals(rs.getstring("a"))) {//this why code skipped st1.executeupdate(sql); joptionpane.showmessagedialog(null, ""+namaop+""); st1.close(); }else{ joptionpane.showmessagedialog(null, "ga kenek"); } } } catch (sqlexception | headlessexception e) { system.out.println(sql); system.out.println(e.getmessage()); joptionpane.showmessagedialog(null, "error!!!"); } }joptionpane.showmessagedialog(null, "iki for");
i'm stuck on code because arrays executed on first array , code if (namaop.equals(rs.getstring("a")))
skipped
Comments
Post a Comment