Subject: too few parameter expected 2
Posted By: samra Post Date: 4/10/2006 2:52:35 AM
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:AOTS1");
  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>





Reply By: AvGuy Reply Date: 4/19/2006 3:23:37 PM
First you posted your topic in Access VBA not Java so you're not going to get much help here most likely.

Second, the error you're experiencing usually comes from failure to suppy a parameter to a function.  In other words, you called a function that requires two parameters and one is missing.

Cheers

AvGuy

Go to topic 37658

Return to index page 309
Return to index page 308
Return to index page 307
Return to index page 306
Return to index page 305
Return to index page 304
Return to index page 303
Return to index page 302
Return to index page 301
Return to index page 300