1.11M Members

SQL insert problem

 
0
 
<%

	String UN=request.getParameter("un");
	String pw=request.getParameter("pw");
	String FN=request.getParameter("FN");
	String LN=request.getParameter("LN");
	String L1=request.getParameter("L1");
	String L2=request.getParameter("L2");
	String L3=request.getParameter("L3");
	String ccn=request.getParameter("ccn");
	
	
	Class.forName("com.mysql.jdbc.Driver").newInstance();
	java.sql.Connection myConn;
	myConn = DriverManager.getConnection
	("jdbc:mysql://localhost:3306/train_resev","root", "3866" );
	
	PreparedStatement ps=myConn.prepareStatement("insert into user values('" + un + "','" + pw + "','" + FN + "','" + LN + "','" + L1 + "','" + L2 + "','" + L3 + "','" + ccn + "')");
		
	ps.executeUpdate();
	
	ps.close();
	myConn.close();
	

	
%>

i get this error
what to do??

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 23 in the jsp file: /My Web Sites/processregister.jsp
un cannot be resolved
20: 	myConn = DriverManager.getConnection
21: 	("jdbc:mysql://localhost:3306/train_resev","root", "3866" );
22: 	
23: 	PreparedStatement ps=myConn.prepareStatement("insert into user values('" + un + "','" + pw + "','" + FN + "','" + LN + "','" + L1 + "','" + L2 + "','" + L3 + "','" + ccn + "')");
24: 		
25: 	ps.executeUpdate();
26:

plzz help

 
1
 

since " is a special character you have to use as \" . remember in any programing language we can not use directly these special character so whenever you want to use this or any other character to compile , you always have to use with \ (slash)

Question Answered as of 3 Years Ago by pushkar honey
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: