View Single Post
  #10 (permalink)  
Old 01-26-07, 09:47 PM
elessar elessar is offline
Newbie Coder
 
Join Date: Jan 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
i was using DW for the code base but ive hand written it now.

I have this page as the search page:
Code:
<%@ Language=VBScript %>
<% pageTitle = "Search Page" %>
<!-- #include file="db.asp" -->
<!-- #include file="adovbs.inc" -->
<%
set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open ConString

set rsCatalog = Conn.Execute("select * from vanprods")
%>

<html>
<head>
<meta name="GENERATOR" Content="Microsoft Visual Studio 6.0">
<title><%= pageTitle %></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="total.css" rel="stylesheet" type="text/css">
</head>

<body>
<table width="70%" border="0" cellpadding="4" cellspacing="4">
  <tr> 
    <td class="total"> Search our Catagories 
      <form action="searchAction.asp" method="post">
        <select name="strCat" multiple size="10">
          <%
            rsCatalog.MoveFirst
            while not rsCatalog.EOF
        %>
          <option value="<%= rsCatalog("CatalogID") %>">
          <%Response.Write rsCatalog("catalogName")%>
          <%
            rsCatalog.MoveNext
            wend
        %>
        </select>
        <p> 
          <input type="submit" value="Submit Query">
      </form>
      <%
rsCatalog.Close
set rsCatalog = Nothing

Conn.Close
set Conn = Nothing
%>
    </td>
  </tr>
</table>
</body>
</html>
Simple:

Here is my results page:
Code:
<%@ Language=VBScript %>
<% pageTitle = "Search Action" %>
<!--#include file="adovbs.inc"-->
<!--#include file="db.asp"-->
<%

cats = Request("strCats")
cats = Replace( cats, ", ", "','" )

set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open ConString

sqlText = "SELECT * FROM products WHERE catalodID IN ('" & cats & "')"
	 
%>
<link href="total.css" rel="stylesheet" type="text/css">        
</head>

<body>
<p class="total">Your search results:</p>
<table width="70%" border="0" cellspacing="3" cellpadding="3">
  <tr bgcolor="#CCCCCC"> 
    <td width="15%" class="total">Product Code</td>
	<td width="35%" class="total">Product Name</td>
    <td width="35%" class="total">Product Packaging</td>
    <td width="15%" class="total">Av Inventory</td>
  </tr>
</table>

<%
set rsProd = Conn.Execute(sqlText)
		
	If rsProd.BOF And rsProd.EOF Then
		Response.Write "<font face='Verdana' size='1'><strong>"
		Response.Write "No items found, please narrow your <a href='javascript:history.back()'>search.</a></b>"
	end if
    
while not rsProd.EOF
%>
<table width="70%" border="0" cellpadding="3" cellspacing="3">
  <tr> 
    <td width="15%" class="total"><a href="product.asp?intProdID=<% Response.Write rsProd("productID") %>"><%= rsProd("productCode") %></a></td>
    <td width="35%" class="total"><%= rsProd("productDesc") %></td>
	<td width="35%" class="total"><%= rsProd("productPack") %></td>
    <td width="15%" class="total"><%= rsProd("NumInStock") %></td>
   </tr>
</table>
<%        
rsProd.MoveNext
wend    
rsProd.Close
set rsProd = Nothing
    
Conn.Close
set Conn = Nothing
%>
</body>
</html>
And here is the error I get when doing the search:
Code:
Technical Information (for support personnel)

Error Type:
Microsoft JET Database Engine (0x80040E10)
No value given for one or more required parameters.
/shop/searchAction.asp, line 31


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 2.0.50215) 

Page:
POST 28 bytes to /shop/searchAction.asp

POST Data:
strCat=7&strCat=10&strCat=12
I don't get where the error is. Please help
Reply With Quote