if i want to code so that the date should be entered in the database when entered in a textbox at the client side like 12/3/05 then how should I do it
if I tke request.getParameter("from date");
then in pst.setDate(fieldnumber,from date);
how should i code this
I m also giving the code
Please help
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
public class schemeservlet extends HttpServlet
{
String fromdate1String schcost1;
Connection con=null;
PreparedStatement pst=null;
Statement stmt=null;
ResultSet rs=null;
public void init(ServletConfig config) throws ServletException
{
super.init(config);
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc

dbc

ata");
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
{
doPost(req,res);
}
public void doPost(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
{
int j;
res.setContentType("text/html");
PrintWriter pw=res.getWriter();
HttpSession s=req.getSession(true);
String str = req.getQueryString();
try
{
int add=str.lastIndexOf("ad.x");
if(add>0)
{
schfromdate1=req.getParameter("schfromdate");
schtodate1=req.getParameter("schtodate");
doinsert(schno1,prodno1,schname1,schfromdate1,schtodate1,schdetail1,schcost1,schbenefit1,invvalue1,schregion1,schcategory1,schapplied1,schbenqty1,schper1,schtype1,pw);
res.sendRedirect("http://localhost:8080/examples/schemeR.jsp");
{
public void doinsert(String fromdate,{
System.out.println("insert");
String sqlint="insert into Scheme" +
sch_from_date)"
+ "values(?)";
try {
pst=con.prepareStatement(sqlint);
}
catch(SQLException e)
{
System.out.println(e);
}
int i=0;
try
{
System.out.println("inside insert executed");
pst=con.prepareStatement(sqlint);
pst.setString(4,schfromdate);
System.out.println("after insert executed");
i=pst.executeUpdate(sqlint);
catch(Exception e)
{
System.out.println(e);
}
}