I add the same code ( INSERT ) record and the path remains with backslashes. Note: C:\Users\COMP\Desktop\Kartinka.png , but when, for example, I want to change ( UPDATE ) this path through the same code, it replaces me, but removes backslashes. Note: C:UsersCOMPDesktopKartinka.png
What is the problem and how to fix it?
JFileChooser chooser=new JFileChooser(); chooser.showOpenDialog(null); File f=chooser.getSelectedFile(); String filename=f.getAbsolutePath(); jTextField1.setText(filename); ImageIcon icon = new ImageIcon(f.getAbsolutePath()); Request to update the record:
query = "UPDATE battle SET name = '"+jTextField2.getText()+"', Image = '"+jTextField1.getText()+"' WHERE name = '"+jTextField2.getText()+"' ;";
query = "UPDATE battle SET name = '"+jTextField2.getText()+"', Image = '"+jTextField1.getText()+"' WHERE name = '"+jTextField2.getText()+"' ;";- Bogdan Oryschychprotected void insertW(String s1, String s2) query = "INSERT INTO db.work (db.work .name, db.work .Image) VALUES (?,?);";and through insertW I transfer the value from the field,insertW(jTextField1.getText(), jTextField2.getText());- Bogdan Oryschychquery = "UPDATE battle SET name = ?, Image = ? WHERE name = ? ;";- Victor Khovanskiy