SQLException says that you want to sort by a db-table-column with name
'listMenuSort1'. But you haven't selected that column.

----- Original Message -----
From: Michael <[EMAIL PROTECTED]>
Date: Thursday, November 29, 2001 1:27 am
Subject: Newbie: What is my mistake in my sort program?

> All my code is below.
> I have a database which will be running queries returning between
> 50 and 150
> records.
>
> I have three simple pages: Search, Result, Invoice.
> The invoice is working properly, displaying the records chosen
> from the
> results page.
>
> To the invoice, I have added four pull-down list menus which allow
> the user
> to create a complex sort using four sort parameters (listMenuSort
> 1,2,3,4 in
> order of precedence.
>
> I am getting this error:
>
> 500 Internal Server Error
> /jserv/Invoice.jsp:Exception thrown on line '30' from page
> 'C:\\Inetpub\\wwwroot\\Beachwear\\jserv\\Invoice.jsp'
> java.sql.SQLException: Column not found: Unknown column
> 'listMenuSort1' in
> 'order clause'
>
> -------------------------------------------------------------------
> -------
> <%@page language="java" import="java.sql.*"%>
> <%@ include file="../Connections/connBeachwear.jsp" %>
> <%
> String rsBeachwear__varCheckbox = "1";
> if (request.getParameter ("valueCheckbox") !=null)
> {rsBeachwear__varCheckbox= (String)request.getParameter
> ("valueCheckbox") ;}
> %>
> <%
> Driver DriverrsBeachwear =
> (Driver)Class.forName(MM_connBeachwear_DRIVER).newInstance();
> Connection ConnrsBeachwear =
>
DriverManager.getConnection(MM_connBeachwear_STRING,MM_connBeachwear_USE
RNAM
> E,MM_connBeachwear_PASSWORD);
> String chkValues[]=request.getParameterValues("valueCheckbox");
> StringBuffer prepStr=new StringBuffer("SELECT ID, Item, Color,
> Size FROM
> Beachwear WHERE ID=");
> for(int x=0;x<chkValues.length;++x){
> prepStr.append( chkValues[x] );
> if((x+1)<chkValues.length){
> prepStr.append(" OR ID=");
> }//end if
> }//end for loop
> PreparedStatement
>
StatementrsBeachwear=ConnrsBeachwear.prepareStatement(prepStr.toString()
);
> ResultSet rsBeachwear = StatementrsBeachwear.executeQuery();
> boolean rsBeachwear_isEmpty = !rsBeachwear.next();
> boolean rsBeachwear_hasData = !rsBeachwear_isEmpty;
> Object rsBeachwear_data;
> int rsBeachwear_numRows = 0;
> %>
> <%
> int Repeat1__numRows = -1;
> int Repeat1__index = 0;
> rsBeachwear_numRows += Repeat1__numRows;
> %>
> <title>Beachwear Title</title>
> <body bgcolor="#FFFFFF">
> <p> </p>
> <p>
>
> //New code attempting to use pull-down List Menu variables to perform
> complex sort:
>
> <form name="form1" method="get" action="Invoice.jsp ORDER BY
> listMenuSort1", "listMenuSort2", "listMenuSort3", "listMenuSort4">
>
> <p><br>
> INVOICE<br>
> <br>
> </p>
> <% while ((rsBeachwear_hasData)&&(Repeat1__numRows-- != 0)) { %>
> <table width="75%" border="1">
> <tr>
> <td width="13%">ID:</td>
> <td width="87%"><%=(((rsBeachwear_data =
> rsBeachwear.getObject("ID"))==null||
> rsBeachwear.wasNull())?"":rsBeachwear_data)%></td></tr>
> <tr>
> <td width="13%">ITEM:</td>
> <td width="87%"><%=(((rsBeachwear_data =
> rsBeachwear.getObject("Item"))==null ||
> rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
> </tr>
> <tr>
> <td width="13%">COLOR:</td>
> <td width="87%"><%=(((rsBeachwear_data =
> rsBeachwear.getObject("Color"))==null ||
> rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
> </tr>
> <tr>
> <td width="13%">SIZE:</td>
> <td width="87%"><%=(((rsBeachwear_data =
> rsBeachwear.getObject("Size"))==null ||
> rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
> </tr>
> </table>
> <%
> Repeat1__index++;
> rsBeachwear_hasData = rsBeachwear.next();
> }
> %>
> <p>  </p>
> <br>
> <table width="37%" border="1">
> <tr>
> <td width="16%">Parameter</td>
> <td width="11%">
> <div align="center">1</div>
> </td>
> <td width="20%">
> <div align="center">2</div>
> </td>
> <td width="20%">
> <div align="center">3</div>
> </td>
> <td width="33%">
> <div align="center">4</div>
> </td>
> </tr>
>
> //New pull-down list Menus:
> <tr>
> <td width="16%">
> <input type="submit" name="Submit" value="Sort">
> </td>
> <td width="11%">
> <select name="listMenuSort1" size="1">
> <option value="ID" selected>ID</option>
> <option value="Item">ITEM</option>
> <option value="Color">COLOR</option>
> <option value="Size">SIZE</option>
> </select>
> </td>
> <td width="20%">
> <select name="select" size="1">
> <option value="ID">ID</option>
> <option value="Item" selected>ITEM</option>
> <option value="Color">COLOR</option>
> <option value="Size">SIZE</option>
> </select>
> </td>
> <td width="20%">
> <select name="select2" size="1">
> <option value="ID">ID</option>
> <option value="Item">ITEM</option>
> <option value="Color" selected>COLOR</option>
> <option value="Size">SIZE</option>
> </select>
> </td>
> <td width="33%">
> <select name="select3" size="1">
> <option value="ID">ID</option>
> <option value="Item">ITEM</option>
> <option value="Color">COLOR</option>
> <option value="Size" selected>SIZE</option>
> </select>
> </td>
> </tr>
>
>
> </table>
> </form>
> <%
> rsBeachwear.close();
> ConnrsBeachwear.close();
> %>
>
>
________________________________________________________________________
___
> To unsubscribe, send email to [EMAIL PROTECTED] and include in
> the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http:
> Resources: http://java.sun.com/products/servlet/external-
> resources.htmlLISTSERV Help:
> http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to