Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_jsp thread: Passing date from form to sql statement


Message #1 by "Joy Lamb" <Joy.Lamb@C...> on Thu, 16 Nov 2000 13:40:01 -0000
Hai!
  First by using the request.getPramater("date");
get the date and using the string stokenizer("/")
divide and get the day and month and year,
after that using the code

java.sql.Date date = new java.sql.Date
(Integer.parseInt(year)-1900, 
 Integer.parseInt(month)-1, 
 Integer.parseInt(day.setDate(4,day);));

pst.setDate(1,d);


PreparedStatement psstmt = con.prepareStatement(sql);
 psstmt.setDate(1,
java.sql.Date.DateFormat.parse(thursday.date));



--- JOY.LAMB@c... wrote: > 
> 
> Hareesh:
> 
> Thank you for answering my question.
> 
> The date format that I am receiving is 11/02/2000. 
> Can I just reverse the code
> that you sent.   Attached is the code where I am
> using this.  Where do I put the
> code to do the conversion.
> 
> String sql ="";
> sql+= "select ws_feedback.submit_dt,
> ws_feedback.feedback_id, ws_feedback.email,
>  ws_feedback_contents.contents ";
> sql+= "from ws_feedback, ws_feedback_contents where
> ws_feedback.feedback_id 
> ws_feedback_contents.feedback_id ";
> sql+= "and ws_feedback.submit_dt = ? order by
> ws_feedback.last_update desc,
> ws_feedback.feedback_id,
> ws_feedback_contents.seq_num";
> 
> PreparedStatement psstmt 
> con.prepareStatement(sql);
> psstmt.setDate(1,
> java.sql.Date.DateFormat.parse(thursday.date));
> 
> Thanks for the help!
> 
> Joy
> 
> 
> 
> 
> hareesh babu <venkata_hareesh@y...> on
> 11/16/2000 08:51:32 AM
> 
> Please respond to "Pro_JavaServer_Pages"
> <pro_jsp@p...>
> 
> 
> 
> To:   "Pro_JavaServer_Pages" <pro_jsp@p...>
> cc:    (bcc: Joy Lamb/CHASE)
> Subject:  [pro_jsp] Re: Passing date from form to
> sql statement
> 
> 
> 
> try with this
> 
> java.sql.Date d
> = new java.sql.Date(Integer.parseInt(year)-1900,
> Integer.parseInt(month)-1,
> Integer.parseInt(daypst.setDate(4,d);));
> pst.setDate(countofthefield,d);
> 
> 
> --- Joy Lamb <Joy.Lamb@C...> wrote: > Hello:
> >
> > I'm trying to gather a date from a form then pass
> it
> > in to the sql
> > prepared statement as part of the where clause.  I
> > have no problem passing
> > a string or passing an int.  With the int I use
> the
> > parse int to convert
> > the string recieved from the form to an int to be
> > used in the sql.  I do
> > not know how to Pass or convert the date.  Any
> help
> > is appreciated.
> >
> >
> > ---
> > NEED TECHNICAL TIPS, TOOLS, AND INSIGHTS?  Is FREE
> > okay?
> > Visit EarthWeb for the latest in IT Management,
> > Software Development,
> > Web Development, Networking & Communications, and
> > Hardware & Systems.
> > Click on http://www.earthweb.com for FREE
> articles,
> > tutorials,
> > and discussions from the experts.
> > venkata_hareesh@y...
> > $subst('Email.Unsub')
> >
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Calendar - Get organized for the holidays!
> http://calendar.yahoo.com/
> 
> ---
> NEED TECHNICAL TIPS, TOOLS, AND INSIGHTS?  Is FREE
> okay?
> Visit EarthWeb for the latest in IT Management,
> Software Development,
> Web Development, Networking & Communications, and
> Hardware & Systems.
> Click on http://www.earthweb.com for FREE articles,
> tutorials,
> and discussions from the experts.
> Joy.Lamb@C...
> $subst('Email.Unsub')
> 
> 
> 
> 
> 
> 
> --- 
> NEED TECHNICAL TIPS, TOOLS, AND INSIGHTS?  Is FREE
> okay?
> Visit EarthWeb for the latest in IT Management,
> Software Development, 
> Web Development, Networking & Communications, and
> Hardware & Systems.  
> Click on http://www.earthweb.com for FREE articles,
> tutorials,
> and discussions from the experts.
> venkata_hareesh@y...
> $subst('Email.Unsub')
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Calendar - Get organized for the holidays!
http://calendar.yahoo.com/

  Return to Index