Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 24th, 2004, 12:29 PM
Authorized User
 
Join Date: Oct 2004
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem in prepared statement

hi,

i have used following prepared Statement for the update in database.

Can any one tell me that,How can i use date in following method.

I have 4 field for date as given below:(BOLD shown)

I have used String in that place.

It is not working.




PreparedStatement pstatement = conn.prepareStatement(
"UPDATE sec_mast SET catg_code=?, vou_no=?, vou_date=?, vou_amt=?, due_date1=?, due_date2=?, mat_date=? where sec_no=? ");

pstatement.setInt(1,Integer.parseInt(request.getPa rameter("catg_code")));
pstatement.setString(2,request.getParameter("vou_n o"));
pstatement.setString(3,request.getParameter("vou_d ate"));
pstatement.setInt(4,Integer.parseInt(request.getPa rameter("vou_amt")));
pstatement.setString(5,request.getParameter("due_d ate1"));
pstatement.setString(6,request.getParameter("due_d ate2"));
pstatement.setString(7,request.getParameter("mat_d ate"));
pstatement.setInt(8,Integer.parseInt(request.getPa rameter("sec_no")));


int rowCount = pstatement.executeUpdate();
conn.setAutoCommit(false);
conn.setAutoCommit(true);
}

plz help me

 
Old November 25th, 2004, 04:22 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What data type do you have in your database?
If you are using a 'date' datatype in your database you will need to ensure that your string is correctly formatted.
Try changing the data type (in the database) to one that will accept a string with no formatting, if this works you know that you have to format your string to the correct date format.








Similar Threads
Thread Thread Starter Forum Replies Last Post
prepared statement sanqry J2EE 0 April 16th, 2006 02:58 AM
problem in prepared Statement abhit_kumar Java Databases 2 March 23rd, 2006 09:34 AM
Prepared SQL VS. Regular Queries nikotromus Pro VB 6 0 January 17th, 2006 08:37 PM
Prepared SQL VS. Regular Queries nikotromus Access VBA 2 January 14th, 2006 06:56 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.