Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a database and created a table.
I have an excel sheet where the data is present. I need to export the data from excel to my database. I am using SQL Server Management Studio 2012. I have written a java code for this. I just have one doubt. How to read the values in excel and export to SQL? I have written the code but it throws "Unclosed String Literal" and "Not a statement" error. Could you please help ? Thanks in advance.

pstm=con.prepareStatement(sql);
String A=row.getCell(0).getStringCellValue();
String B =row.getCell(1).getStringCellValue();
String C =row.getCell(2).getStringCellValue();
String D =row.getCell(3).getStringCellValue();
String sql ="INSERT INTO tablename" + "VALUES('"+A+"',
'"+B+"',
'"+C+"',
'"+D+"')";


Can you tell me what is the error in this?
Posted

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900