java - Insert value into database using jdbc -


i using ms-access , java connection of jdbc-odbc driver. code below, i'm trying create registration textbox when add values, result "null" in database. how real value i'm inserting ? thanks

    class.forname("sun.jdbc.odbc.jdbcodbcdriver");      connection con = drivermanager.getconnection("jdbc:odbc:adb");      statement statement = con.createstatement();      statement.executeupdate("insert login " + "values  ('"+uname+"','"+pwd+"')");       uname = usertextbox.gettext();     pwd = passtextbox.gettext(); 

from looks of it, statement code fine. problem you're initializing uname , pwd after execute it.

i'm assuming somewhere above have initialized these variables null. so, @ time statement executed, values has insert null.


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -