Follow us on twitter

Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.


    • CommentAuthorJAD716
    • CommentTimeNov 15th 2009
     
    Well, here´s another bit of my Java project witch is giving me some headache(if you guys remember, the deadline for it is this tuesday)
    well, I´m trying to make the final part fo the sale process, but I´m having trouble with taking the stuff from the shopping cart(a SQL table) and place it on the sold item table(given that the sale id code is given here, where the shopping cart is already done)
    so, in fact I´m having trouble with the insert SQL querys shown here.
    any help will be much appreciated

    Code:

    String cod = jTcodcompra.getText();
            try{
    bd.entBanco();
    bd.stmt.executeUpdate("insert into tempvenda(cod_venda) values ("+cod+") where cod_produto>0");
    bd.stmt.executeUpdate("insert into itemvenda (select * from tempvenda)");
    bd.stmt.executeUpdate("DELETE from tempvenda");
    JOptionPane.showMessageDialog(null, cod);
    }
    catch(SQLException e){ //trata os erros
    JOptionPane.showMessageDialog(this,"Error SQL Cmmd "+e.getMessage());
    }
            new Vendas().show();
            this.dispose();
        }         
  1.  

    well, found a way to make it work: 

    String cod = jTcodcompra.getText(); 
            try{ 
    bd.entBanco(); 
    bd.stmt.executeUpdate("insert into itemvenda select cod_venda, cod_produto, nome_produto, preco_produto, quantidade from tempvenda"); 
    bd.stmt.executeUpdate("DELETE from tempvenda"); 
    JOptionPane.showMessageDialog(null, cod); 


    catch(SQLException e){ 
    JOptionPane.showMessageDialog(this,"Error SQL Cmmd "+e.getMessage()); 
    }

     

    I made that problematic insert in another form, alongside the rest of that insert. 
    now, the problem is that it doesn�t makes more than one insert(more than one product being bought) 
    so, any solutions?

Add your comments