i don't know wrong code; sql commands , path looks alright. connect db ok; when try pass simple search; returns that table doesn't exist. tried (the same code) in different method add data , works fine; don't know i'm doing wrong.
thanks attention.
public static void main(string[] args) { eventqueue.invokelater(new runnable() { public void run() { try { first_gui frame = new first_gui(); frame.setvisible(true); } catch (exception e) { e.printstacktrace(); } } }); } connection conn = null; //call connection class javasqlite class /** * create frame. */ public first_gui() { conn = sqlite_connection.dbconnector(); //call connection conn sqlite class, method dbconnector. settitle("first gui app"); setdefaultcloseoperation(jframe.exit_on_close); setbounds(100, 100, 450, 300); contentpane = new jpanel(); contentpane.setborder(new emptyborder(5, 5, 5, 5)); contentpane.setlayout(new borderlayout(0, 0)); setcontentpane(contentpane); jpanel panel = new jpanel(); flowlayout flowlayout = (flowlayout) panel.getlayout(); flowlayout.setalignment(flowlayout.left); contentpane.add(panel, borderlayout.north); jlabel lblenterthename = new jlabel("enter name :"); lblenterthename.setfont(new font("tahoma", font.plain, 14)); lblenterthename.setverticalalignment(swingconstants.top); lblenterthename.sethorizontalalignment(swingconstants.left); panel.add(lblenterthename); namefield = new jtextfield(); panel.add(namefield); namefield.setcolumns(10); jbutton search = new jbutton("search"); search.addactionlistener(new actionlistener() { public void actionperformed(actionevent arg0) { // **************************************************************** // here problem. string sql = "select * bank_001 accountname ?"; try { preparedstatement pst = conn.preparestatement(sql); pst.setstring(1, namefield.gettext()); resultset rs = pst.executequery(); rs.close(); pst.close(); } catch (sqlexception e) { e.printstacktrace(); joptionpane.showmessagedialog(null, e); } } }); panel.add(search); jscrollpane scrollpane = new jscrollpane(); contentpane.add(scrollpane, borderlayout.center); jtextpane textpane = new jtextpane(); textpane.setfont(new font("tahoma", font.plain, 14)); scrollpane.setviewportview(textpane); } }


can show code ?
conn = sqlite_connection.dbconnector(); are using seturl() on new sqlitedatasource ?
assuming using seturl, constructed correctly ? like:
"jdbc:sqlite:sqlite-test.db"
Comments
Post a Comment