where clause not working with and jdbc java sql 58340 - where clause not working with AND, JDBC/JAVA/SQL

The code below works fine when i remove this part (+"AND ref = '"+Mref.getText()+"'");)  but doesn’t work with it:

pst1=  con.prepareStatement(" SELECT  price from article where barcode = '"+Mbarcode.getText()+"'" +"AND ref = '"+Mref.getText()+"'");
ResultSet rs1 ;
rs1= pst1.executeQuery(); ```

thisis the table named article in my database

barcode | name  |qty    |price  |vendor |ref    | maxremise 
READ MORE:  Great Advice For Handling Your Back Pain

related posts:

August 27, 2022

August 10, 2022

August 10, 2022

July 13, 2022

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}