mahemaa.iyer 0 Newbie Poster
  protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
                        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        try {
            int c=0;
             String u1=request.getParameter("u1");
            String e1=request.getParameter("e1");
            String user=request.getParameter("user1");
            request.setAttribute("u1",u1);
            request.setAttribute("e1",e1);
            request.setAttribute("user", user);
            out.println("welcOme"); 
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con =DriverManager.getConnection("Jdbc:Odbc:db5");
String str = "select * from Table1 where email=?";
 out.println("welcOme");
PreparedStatement statement = con.prepareStatement(str);
statement.setString(1,user);
ResultSet rs=statement.executeQuery();
if(rs.next())
             {
             out.println(rs.getString(1)+" User found!!!!<br>");
             out.println("Enter the info you wanna send<br>");
             out.println("<input type=text name=inf size=25 /><br>");
             out.println("<input type=submit value=\"send\" /><br>");
             c++;
             }
  else
  {
      out.println("Error!!! <a href=mahi6.jsp>Go back to previous page</a>");
  } 
statement.close();
con.close();
            RequestDispatcher rd=request.getRequestDispatcher("/mahi8");
            rd.forward(request,response);
}
catch(Exception e)
{
    out.println(e);
}
finally {            
            out.close();
        }
    }

It shows the following error
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Username:kalshmi Email:look@hoo.com info:null'.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.