We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,376 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

SQL insert problem

<%

	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

2
Contributors
1
Reply
8 Minutes
Discussion Span
1 Year Ago
Last Updated
2
Views
Question
Answered
y2kshane
Light Poster
35 posts since Aug 2010
Reputation Points: 8
Solved Threads: 0
Skill Endorsements: 0

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)

pushkar honey
Newbie Poster
13 posts since Feb 2008
Reputation Points: 6
Solved Threads: 2
Skill Endorsements: 0
Question Answered as of 1 Year Ago by pushkar honey

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0709 seconds using 2.8MB