Hi all... I am using JSP page to insert a date time field into an SQL Server 2000 database. I am not able to do it. Can any1 tell me how to do it. I'll be thankful if he/she can provide a small example. I am providing the code I am using... My Scenario... =============== I have a 3 combo boxes showing Day (1 to 31), Month (Jan to Dec) and Year (1970 to 2020). Now in my JSP file I have written... String strDay=request.getParameter("day"); String strMon=request.getParameter("month"); String strYr=request.getParameter("year"); String dob=strDay+"-"+strMon+"-"+strYr;
In my database operation part (i have used PreparedStatement interface), I have written... PST.setDate(2,dob); I cannot insert it ... please some1 help me.. N Nanda
Hmm. Not very descriptive. Post your error, then we can help. [ April 06, 2004: Message edited by: eammon bannon ]
Joined: Feb 09, 2004
Thank you for your response, I am getting following error... type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: Unable to compile class for JSP An error occurred at line: 40 in the jsp file: /jsp/project/manage_personal.jsp Generated servlet error: [javac] Compiling 1 source file C:\Apache\Tomcat5\work\Catalina\localhost\nnsweb\org\apache\jsp\jsp\project\manage_005fpersonal_jsp.java:92: cannot resolve symbol symbol : method setDate (int,java.lang.String) location: interface java.sql.PreparedStatement PST.setDate(4,strDate); ^ 1 error
Hi, I have noticed that you are passing wrong argument in setDate Method of PreparedStatement. Bellow is the exact method: setDate(int indexNumber, javax.sql.Date date); and you are passing setDate(int indexNumber, String date); I hope this will solve your problem. Make sure pass javax.sql.Date object not java.util.Date object. buuurraaaaaaaa...