too few parameter expected 2
Can any one tell me i have design a form which i tried with a table of having 10 records it works ,but when i try to acces main table which have more than 5,000 record
it gives me the error "too few parameters expected 2"
why
<html>
<head>
<title>
AOTS
</title>
</head>
<jsp:useBean id="AOTSBeanId" scope="session" class="aots.AOTSBean" />
<jsp:setProperty name="AOTSBeanId" property="*" />
<body>
<%@ page language="java" import="java.util.*"%>
<body>
<p>update database content
<form action="updatephonebook.jsp" method="post">
Region:<input type=text name=regionparam><br>
Bill Month From:<input type=text name=billfromparam><br>
Bill Month To:<input type=text name=billtoparam><br>
<input type=Submit value="Retrive from DB">
</form>
<p> content of phone book database:
<table border=1 cellpadding=0 cellspacing=0>
<tr><td> Phone NO </td>
<td> Current Bill </td>
<td> Net Payable </td>
</tr>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
java.sql.Connection connection = java.sql.DriverManager.getConnection("jdbc:odbc:AO TS1");
java.sql.Statement statement = connection.createStatement();
Enumeration parameters = request.getParameterNames();
if(parameters.hasMoreElements()){
String LastValue = request.getParameter("regionparam");
String FirstValue = request.getParameter("billfromparam");
String PhoneValue = request.getParameter("billtoparam");
// statement.executeUpdate("INSERT INTO updatephonebook (LAST,FIRST,PHONE) VALUES ('"+LastValue+"','"+FirstValue+"','"+PhoneValue+"' )");
java.sql.ResultSet columns = statement.executeQuery(
// "SELECT * FROM updatephonebook");
//"SELECT LAST,FIRST,PHONE FROM updatephonebook WHERE LAST=" + LastValue + " AND FIRST =" + FirstValue + " AND PHONE="+PhoneValue+" ");
"SELECT PHONE_NO,GROSS_CURRENT_BILL,AMOUNT_PAYABLE FROM AOTS WHERE REGION_CODE='" + LastValue + "' AND ISSUE_DATE ='" + FirstValue + "' AND DUE_DATE='"+PhoneValue+"' ");
while(columns.next()){
String last = columns.getString("PHONE_NO");
String first = columns.getString("GROSS_CURRENT_BILL");
String phone= columns.getString("AMOUNT_PAYABLE");%>
<TR>
<TD> <%=last %></td>
<TD> <%=first %></td>
<TD> <%=phone %></td>
</tr>
<%}
}%>
</table>
</body>
</html>
|