This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
Hi all, Im unable to insert text data into a table when the text im trying insert has quotes. Ex: String sql1="INSERT into project VALUES ('"+project+"','"+desc+"')"; int status1=st1.executeUpdate(sql1); the above code is working fine as long as im inserting text data with out quotes. However, its failing when im triyng to insert text data which contains quotes. How can i insert text data that has quotes into a table. Im using MS Access as back end. regards satish
Hi Satish, welcome to the Java Ranch I haven't tried this but I know it works in ASP so I expect it should also work in Java... You need to enclose the actual text with single ' so you end up with String sql1="INSERT into project VALUES ('"' +project+ '"','"' +desc+ '"')";