I would like to ask on how to do calculations and saving the result and retrieve again just like making a deposit and withdrowal in banking system. i really dont know how to do so.. i am trying to formulate some codes but it just don't work. Pls help. I am using netbeans and sqlite as my database!

"Don't work" isn't enough information for us to help... please post the code you have so far.

I HAve this code.. and I want to subtract a current value in my program which is the loadamount from a VALUE in my database which is balance. And put rem as the result of it and as a new value for balance.

double rem=0; String bal; double getbal;

    try
{
    Class.forName("org.sqlite.JDBC").newInstance();
    conn = DriverManager.getConnection("jdbc:sqlite:E:\\OfficialJAVA\\data.sqlite");
    String data = "select * from userinfo where username =? and balance=? ";

    ps = conn.prepareStatement(data);
    ps.setString(1, n);
    rs = ps.executeQuery();
    if (rs.next()) {
        bal = rs.getString("balance");
        getbal=Double.parseDouble(bal);
       l= Double.parseDouble(txloadsrp.getText());
       rem= getbal-l;   
       }
    }catch(Exception e)
    {
    JOptionPane.showMessageDialog(null, e);
    }

your question is not clear.What exactly do you want to do ?What error you are getting?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.