Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
203 views
in Technique[技术] by (71.8m points)

How can I insert a jspinner integer value in Mysql database using Java?

Good evening, I try to insert values in the database but the jspinner ones caused a problem for the success of my request. Please help me. this is my code :

            String sql=" insert into produit(reference , designation , uniteMesure , code, stock , prixUnitaireHTaxe , desg_fam , code_fournisseur) values(? , ? , ? , ? , ? , ? , ? , ? ) ";
        
                    try {
                                    
                prepared=cnx.prepareStatement(sql);
                prepared.setString(1,txtRef.getText().toString());
                prepared.setString(2,txtDesg.getText().toString());
                prepared.setString(3,comboBox.getSelectedItem().toString());
                prepared.setString(4,jspinner.getSelectedItem().toString());
                //prepared.setString(5,txtMin.getS.toString());
                prepared.setString(6,txtPrix.getText().toString());
                prepared.setString(7,txtDesign.getText().toString());
                prepared.setString(8,txtCode.getText().toString());
                prepared.setString(9,txtFour.getText().toString());
                
            
            
                
                    JOptionPane.showMessageDialog(null,"Produit ajouté :D");
                    
                }
                        
                    
                    catch(SQLException e1) {
                    e1.printStackTrace();
                
                
                    }
            
         ```


question from:https://stackoverflow.com/questions/65911234/how-can-i-insert-a-jspinner-integer-value-in-mysql-database-using-java

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...