Too few parameters

Hi friends,

please solve this below problem. Exception is "-Too few parameters"..

import java.io.*;

import Java.*;

import javax.servlet.http.*;

import java.sql.*;

import javax.sql.*;

public class EmpData extends HttpServlet {

public void service (HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{

try {

PrintWriter out;

out=response.getWriter();

response.setContentType("text/plain");

String a =request.getParameter("id");

String b =request.getParameter("ename");

String c =request.getParameter("esal");

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection con = DriverManager.getConnection("jdbc:odbc:malloc");

Statement stmt = con.createStatement();

out.println(a);

out.println(b);

out.println(c);

stmt.executeUpdate("insert into emp values (" + " ' " + a + " ' " + " , "+ " ' " + b + " ' " + ", " + " ' " + c +" ' "+ ")" );

}catch(Exception e) {

System.out.println(e);

}

}

}

[1103 byte] By [chennakesavaraoa] at [2007-11-26 19:16:16]
# 1

What's the actual value of that string? Don't just post a dog's breakfast of quotes that you put in your code to compute the string, post the string.

And if you had posted this in the JDBC forum (being the question about your database queries that it is) you would have been told to use a PreparedStatement to avoid that awful mess of quotes. That would be a good idea in any case.

When you look at the string you're probably going to find you are missing quotes around something that is supposed to be a string constant, and Access would try to interpret that as a table name or a column name. If there is no such table or column you get this sort of message.

DrClapa at 2007-7-9 21:29:10 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...