Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #16  
Old January 11th, 2005, 03:55 PM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
Click here for more information.
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,198 nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)  Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 Days 8 h 39 m 27 sec
Reputation Power: 719
Hi look at this post I made, that was just an example to show you that the like statement is messing with you.

try building up your statements using the example below

Quote:
Originally Posted by nofriends
Hi,

i am glad you like my Afrikaans , I can almost understand everything in Dutch if I read it a couple of times, very similair to Afrikaans.

Yes, that is what I mean, check the parameter's and build your query from that, here is a short example.
Code:
	Dim strSql
	Dim strWhere
	
	strSql = "SELECT * FROM Boeken WHERE "
	
	If Titel <> "" Then
		strWhere = strWhere & "Titel LIKE '%" & Titel & "%' "
	end if
	
	If Ondertitle <> "" Then
		if strWhere = "" then
			strWhere = strWhere & "Ondertitel LIKE '%" & Ondertitel & "%' "
		else
			strWhere = strWhere & "and Ondertitel LIKE '%" & Ondertitel & "%' "		
		end if
	end if

	If Auteur <> "" Then
		if strWhere = "" then
			strWhere = strWhere & "Auteur LIKE '%" & Auteur & "%' "
		else
			strWhere = strWhere & "and Auteur LIKE '%" & Auteur & "%' "		
		end if
	end if
	
	strSql = strSql & strWhere & ";"
	
	Results.Open strSql

-->I added this code instead of 
Results.Open "SELECT * FROM Boeken WHERE Categorie LIKE '" & Cat("Categorie") & "';", Conn


Hope this helps.

Reply With Quote
  #17  
Old January 11th, 2005, 04:02 PM
stensol stensol is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: Netherlands
Posts: 28 stensol User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 9 m 10 sec
Reputation Power: 0
Quote:
Originally Posted by nofriends
Hi look at this post I made, that was just an example to show you that the like statement is messing with you.

try building up your statements using the example below


I'm now busy adding all values to make that parameter-check complete, hope it works.
will make a new post within a few minutes, cause I don't know yet how to paste it in my whol script.

Reply With Quote
  #18  
Old January 11th, 2005, 04:15 PM
stensol stensol is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: Netherlands
Posts: 28 stensol User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 9 m 10 sec
Reputation Power: 0
WOWWWWWW!!!!!!!!!!!!!!!!!!!!!!!!!

This is EXACTLY what I need, it works!
Thanks for a million 'NoFriends' !

When project is finished, I'll e-mail you the .zip file if you want (it's all in Dutch, )

I now go further with the script .. can't wait untill it's finished!!

Best regards,
Bart Stens

By the way: where do u live in Africa? (south?)

Reply With Quote
  #19  
Old January 11th, 2005, 04:20 PM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
Click here for more information.
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,198 nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)  Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 Days 8 h 39 m 27 sec
Reputation Power: 719
Hi Bart,

Gald you got it working!

I live in South Africa, in Cape Town.

I would like it if you send me the whole thing when you are done.

Just send me a private message when you are done, then I will now to look for a new post from you.

If you don't know how to send a private msg, just click on my name.

Cheers.

Hoop jyt 'n baie lekker aand.

Reply With Quote
  #20  
Old January 12th, 2005, 03:11 AM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
Click here for more information.
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,198 nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)  Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 Days 8 h 39 m 27 sec
Reputation Power: 719
Hi Bart,

here is the zoek_get.asp page

zoek_get.asp
Code:
  <%
  If Request.QueryString("Nummer") = "" Then
  
   On Error Resume Next
   
  Set Conn = Server.CreateObject("ADODB.Connection")
  		Conn.Provider = "Microsoft.Jet.OLEDB.4.0"
  		Conn.Open Server.MapPath("Books.mdb")
  
  Titel = replace(Request("txtTitel"), " ", "%")
  Ondertitel = replace(Request("txtOndertitel"), " ", "%")
  Auteur = replace(Request("txtAuteur"), " ", "%")
  Jaar = replace(Request("txtJaar"), " ", "%")
  Jaargang = replace(Request("txtJaargang"), " ", "%")
  Uitgever = replace(Request("txtUitgever"), " ", "%")
  Bijzonderheden = replace(Request("txtBijzonderheden"), " ", "%")
  
  
  
  Set Cat = Server.CreateObject("ADODB.recordset")
 		Cat.Open "SELECT DISTINCT Categorie FROM Boeken WHERE Categorie LIKE '%" & Request("cmbCategorie") & "%';", Conn
  		'Cat.Open "SELECT Categorie FROM Boeken;", Conn
  
   Set Counter = Server.CreateObject("ADODB.recordset")
 	 Counter.Open "SELECT COUNT(*) AS TellerVan FROM Boeken WHERE Titel LIKE '%" & Titel & "%' and Ondertitel LIKE '%" & Ondertitel & "%' and Auteur LIKE '%" & Auteur & "%' and Jaar LIKE '%" & Jaar & "%' and Jaargang LIKE '%" & Jaargang & "%' and Uitgever LIKE '%" & Uitgever & "%' and Bijzonderheden LIKE '%" & Bijzonderheden & "' and Categorie LIKE '" & Request("cmbCategorie") & "%' and Nummer LIKE '%" & Nummer & "%';", Conn
  
   Set Counter2 = Server.CreateObject("ADODB.recordset")
  	 Counter2.Open "SELECT COUNT(*) AS TellerTot FROM Boeken;", Conn
  %>
 Er zijn <b><%Response.Write(Counter("TellerVan"))%></b> van de <b><%Response.Write(Counter2("TellerTot"))%></b> resultaten gevonden die aan uw zoekcriteria voldoen.
  <br><br><br>
  <table width="95%" border="0" cellpadding="0" cellspacing="0">
  
  <%
   Call Cat.MoveFirst()
   While Not Cat.EOF
  
   Set Results = Server.CreateObject("ADODB.recordset")
  
  Dim strSql
  	Dim strWhere
  	strWhere = ""
  	
  	strSql = "SELECT * FROM Boeken WHERE "
  
  	If Titel <> "" Then
 			strWhere = strWhere & "Titel LIKE '%" & Titel & "%' "
  	end if	
  
  	If Ondertitel <> "" Then
  		if strWhere = "" then
 			strWhere = strWhere & "Ondertitel LIKE '%" & Ondertitel & "%' "
  		else
 			strWhere = strWhere & "and Ondertitel LIKE '%" & Ondertitel & "%' "		
  		end if
  	end if
  
  	If Auteur <> "" Then
  		if strWhere = "" then
 			strWhere = strWhere & "Auteur LIKE '%" & Auteur & "%' "
  		else
 			strWhere = strWhere & "and Auteur LIKE '%" & Auteur & "%' "		
  		end if
  	end if
  	
  	If Jaar <> "" Then
  		if strWhere = "" then
 			strWhere = strWhere & "Jaar LIKE '%" & Jaar & "%' "
  		else
 			strWhere = strWhere & "and Jaar LIKE '%" & Jaar & "%' "		
  		end if
  	end if
  	
  	If Jaargang <> "" Then
  		if strWhere = "" then
 			strWhere = strWhere & "Jaargang LIKE '%" & Jaargang & "%' "
  		else
 			strWhere = strWhere & "and Jaargang LIKE '%" & Jaargang & "%' "		
  		end if
  	end if
  	
  	If  Uitgever <> "" Then
  		if strWhere = "" then
 			strWhere = strWhere & "Uitgever LIKE '%" & Uitgever & "%' "
  		else
 			strWhere = strWhere & "and Uitgever LIKE '%" & Uitgever & "%' "		
  		end if
  	end if
  	
  	If  Bijzonderheden <> "" Then
  		if strWhere = "" then
 			strWhere = strWhere & "Bijzonderheden LIKE '%" & Bijzonderheden & "%' "
  		else
 			strWhere = strWhere & "and Bijzonderheden LIKE '%" & Bijzonderheden & "%' "		
  		end if
  	end if
  	
  	If Categorie <> "" Then
  		if strWhere = "" then
 			strWhere = strWhere & "Categorie LIKE '%" & Categorie & "%' "
  		else
 			strWhere = strWhere & "and Categorie LIKE '%" & Categorie & "%' "		
  		end if
  	end if
  	
  	If Nummer <> "" Then
  		if strWhere = "" then
 			strWhere = strWhere & "Nummer LIKE '%" & Nummer & "%' "
  		else
 			strWhere = strWhere & "and Nummer LIKE '%" & Nummer & "%' "		
  		end if
  	end if
  	
  	strSql = strSql & strWhere & ";"
  
  	Results.Open strSql, conn
  
  
  
  
   Call Results.MoveFirst()
  	  if Results("Titel") = "" then
  	  else
  %>
  
  
  
  	  <tr>
  	 <td width="306" height="2" colspan="4" bgcolor="#960000">
  	 </td>
  	</tr>
  	
  	  <tr>
  	 <td colspan="4" height="45" valign="bottom">
 	 <font color="#960000"><h4><%=Results("Categorie") %></h4></font></td>
  	</tr>
  	
  	  <tr>
 	 <td width="8%" height="20" valign="top"><font color="#888888"><b>Nr.</b></font></td>
 	 <td width="40%" height="20" valign="top"><font color="#888888"><b>Titel</b></font></td>
 	 <td width="32%" height="20" valign="top"><font color="#888888"><b>Ondertitel</b></font></td>
 	 <td width="20%" height="20" valign="top"><font color="#888888"><b>Auteur</b></font></td>
  	</tr>
  
  <%
    While Not Results.EOF
  %>
  
  	<tr>
 		<td width="8%" valign="top"><font color="#960000"><%=Results("Nummer")%><font color="#960000"></td>
 	 <td width="40%" valign="top"><a href="index.asp?Pagina=boek&Nummer=<%=Results("Nummer")%>" target="_self"><%=Results("Titel")%></a><br><br></td>
 	 <td width="32%" valign="top"><%=Results("Ondertitel")%></a><br><br></td>
  	  <td width="20%" valign="top"><%=Results("Auteur")%></td>
  	  </tr>
  
  <%
   Call Results.MoveNext()
   Wend
  %>
  
  	<tr>
  	 <td>&nbsp;</td>
  	</tr>
  
  <%
     end if
   Call Cat.MoveNext()
   Wend
   Results.Close
  %>
  
   </table>
   <br>
  Klik <a href="#" onclick="history.go(-1)" alt="Ga terug">hier</a> om terug te gaan
  <br><br>
  <%
   Cat.Close
   Counter.Close
   Counter2.Close
   Conn.Close
  %>
  
  <%
  End If
  %>
  


The parts in red is what I changed.

zoek_form.asp
Code:
  <%
  Set Conn = Server.CreateObject("ADODB.Connection")
  		Conn.Provider = "Microsoft.Jet.OLEDB.4.0"
  		Conn.Open Server.MapPath("Books.mdb")
  
  Set Rs = Server.CreateObject("ADODB.recordset")
  	  Rs.Open "SELECT Cat FROM Categorie;", Conn
  
  %>
  <table cellpadding="0" cellspacing="0" border="0" width="100%">
  <h3>Zoeken op:</h3>
  <form name="zoeken" method="post" action="zoek_get.asp">
  
  <table cellspacing="0" border="0">
  
  
  <!-- >>>> ZOEKVELD VOOR Titel -->
  <tr>
    <td width="120">Titel:</td>
    <td>
  	  <input type="text" name="txtTitel" class="box-200" maxlength="100" >
    </td>
  </tr>
  <!-- *************************** -->
  
  
  <!-- >>>> ZOEKVELD VOOR Ondertitel -->
  <tr>
    <td width="120">Ondertitel :</td>
    <td>
  	  <input type="text" name="txtOndertitel" class="box-200" maxlength="100" >
    </td>
  </tr>
  <!-- *************************** -->
  
  
  <!-- >>>> ZOEKVELD VOOR Auteur-->
  <tr>
    <td width="120">Auteur:</td>
    <td>
  	  <input type="text" name="txtAuteur" class="box-100" maxlength="50" >
    </td>
  </tr>
  <!-- *************************** -->
  
  	  <tr><td>&nbsp;</td></tr>
  
  <!-- >>>> ZOEKVELD VOOR Jaar-->
  <tr>
    <td width="120">Jaar:</td>
    <td>
  	  <input type="text" name="txtJaar" class="box-100" maxlength="100" >
    </td>
  </tr>
  <!-- *************************** -->
  
  
  <!-- >>>> ZOEKVELD VOOR Jaargang -->
  <tr>
    <td width="120">Jaargang:</td>
    <td>
  	  <input type="text" name="txtJaargang" class="box-100" maxlength="100" >
    </td>
  </tr>
  <!-- *************************** -->
  
  	  <tr><td>&nbsp;</td></tr>
  
  <!-- >>>> ZOEKVELD VOOR Uitgever -->
  <tr>
    <td width="120">Uitgever:</td>
    <td>
  	  <input type="text" name="txtUitgever" class="box-200" maxlength="100" >
    </td>
  </tr>
  <!-- *************************** -->
  
  
  <!-- >>>> ZOEKVELD VOOR Bijzonderheden -->
  <tr>
    <td width="120">Bijzonderheden:</td>
    <td>
  	  <input type="text" name="txtBijzonderheden" class="box-200" maxlength="100" >
    </td>
  </tr>
  <!-- *************************** -->
  
  
  <!-- >>>> ZOEKVELD VOOR Categorie -->
  <tr><td width="120">Categorie:</td>
  	  <td>
  		  <select name="cmbCategorie" class="box-200">
  		   <option value=""></option>
  		   
  <%
  Call Rs.MoveFirst()
  While Not Rs.EOF
  %>
 		 <option value="<%=Rs("Cat")%>"><%=Rs("Cat")%></option>
  <%
  call Rs.MoveNext()
  Wend
  %>
  
  		  </select>
  	   </td>
  	  </tr>
  <!-- *************************** -->
  
  
  <!-- >>>> BUTTONS -->
  <tr><td></td>
    <td><br>
  	<input type="Submit" value="Zoeken" Name="btnZoeken" class="Button">
  	<input type="Reset" value="Wis invoer" class="button">
    </td>
  </tr>
  <!-- *************************** -->
     </table>
    </form>
  <!-- Form stop hier -->
  
  <!-- Begin VBScript -->
  
  <!--
  <script language="VBScript">
  <!--
  Sub btnZoeken_OnClick()
   if (document.zoeken.txtTitel.Value = "") AND (document.zoeken.txtOndertitel.Value = "") AND _
  	(document.zoeken.txtAuteur.Value = "") AND (document.zoeken.txtJaar.Value = "") AND _
  	(document.zoeken.txtJaargang.Value = "") AND (document.zoeken.txtUitgever.Value = "") AND _
  	(document.zoeken.txtBijzonderheden.Value = "") AND (document.zoeken.cmbCategorie.Value = "" ) Then
  	  MsgBox "U heeft niets ingevuld!"
   else
  	  MsgBox "Er is een fout opgetreden, probeer het opnieuw!"
   end if
  end Sub
  -->
  <!-- </script> -->
  


hope this sorts out your problem.
Another thing, if you don't select a category, it loops the same title for all the categories, think you should change that.

Njoy!

Let me know if there is any other snags.

Kind Regards
noFriends

Reply With Quote
  #21  
Old January 12th, 2005, 04:27 AM
stensol stensol is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: Netherlands
Posts: 28 stensol User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 9 m 10 sec
Reputation Power: 0
Hi nofriends,

Ow, I just see that I didn't included RemoveHTML.asp in the .zip-file.
Were you than able to open my website? (UPDATES attached to sent email)

Plz. run my website by index.asp and you can click on left buttons
which activate the search-script with a value, but don't seem to get a
result
as some of those links only post the value cmbCategorie..
(click on buttons BOEKEN, PLAATJESALBUMS, REVUE DER SPORTEN)
In the url you can see that only cmbCategorie is sent, and the
*counter-part*
of the zoek_get.asp DOES count the correct number of records, but those
records won't be shown below.

HOW is that possible?

I've checked the whol script, but the part for which my topic actually
started, the emtpy-field *replacer* code? how to implement that for now?

Regards,
Bart

Reply With Quote
  #22  
Old January 12th, 2005, 04:35 AM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
Click here for more information.
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,198 nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)  Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 Days 8 h 39 m 27 sec
Reputation Power: 719
hi,

I could not open you whole site.

only the stuff in the bkp folder,

can you send me the whole site again please.

Reply With Quote
  #23  
Old January 12th, 2005, 05:57 AM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
Click here for more information.
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,198 nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)  Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 Days 8 h 39 m 27 sec
Reputation Power: 719
Hi Bart,

Download the attached zip file(email), the whole site is in there.
It should work fine now, I changed the query at the top,
and changed
Code:
 if strWhere = "" then
    strWhere = strWhere & "Categorie LIKE '%" & Cat("Categorie") & "%' "
 else
    strWhere = strWhere & "and Categorie LIKE '%" & Cat("Categorie") & "%' "		
 end if
 

Cat("Categorie") --> this is the category passed from the zoek_form.asp page.

Let me know if you need any more help.

Reply With Quote
  #24  
Old January 17th, 2005, 02:12 AM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
Click here for more information.
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,198 nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)nofriends User rank is Major General (70000 - 90000 Reputation Level)  Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1Folding Points: 175451 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 Days 8 h 39 m 27 sec
Reputation Power: 719
Hi Bart,

here is the code for zoek_get.asp

it should work fine now
Code:
   <%
   If Request.QueryString("Nummer") = "" Then
   
    On Error Resume Next
    
   Set Conn = Server.CreateObject("ADODB.Connection")
 		  Conn.Provider = "Microsoft.Jet.OLEDB.4.0"
 		  Conn.Open Server.MapPath("Books.mdb")
   
   Titel = replace(Request("txtTitel"), " ", "%")
   Ondertitel = replace(Request("txtOndertitel"), " ", "%")
   Auteur = replace(Request("txtAuteur"), " ", "%")
   Jaar = replace(Request("txtJaar"), " ", "%")
   Jaargang = replace(Request("txtJaargang"), " ", "%")
   Uitgever = replace(Request("txtUitgever"), " ", "%")
   Bijzonderheden = replace(Request("txtBijzonderheden"), " ", "%")
   
    Set Counter = Server.CreateObject("ADODB.recordset")
 '----------------------------- 
   Dim strSql
 	  Dim strWhere
 	  strWhere = ""
 	  
 	  strSql = "SELECT COUNT (*) AS TellerVan FROM Boeken WHERE "
   
 	  If Titel <> "" Then
 			 strWhere = strWhere & "Titel LIKE '%" & Titel & "%' "
 	  end if	
   
 	  If Ondertitel <> "" Then
 		  if strWhere = "" then
 			 strWhere = strWhere & "Ondertitel LIKE '%" & Ondertitel & "%' "
 		  else
 			 strWhere = strWhere & "and Ondertitel LIKE '%" & Ondertitel & "%' "		
 		  end if
 	  end if
   
 	  If Auteur <> "" Then
 		  if strWhere = "" then
 			 strWhere = strWhere & "Auteur LIKE '%" & Auteur & "%' "
 		  else
 			 strWhere = strWhere & "and Auteur LIKE '%" & Auteur & "%' "		
 		  end if
 	  end if
 	  
 	  If Jaar <> "" Then
 		  if strWhere = "" then
 			 strWhere = strWhere & "Jaar LIKE '%" & Jaar & "%' "
 		  else
 			 strWhere = strWhere & "and Jaar LIKE '%" & Jaar & "%' "		
 		  end if
 	  end if
 	  
 	  If Jaargang <> "" Then
 		  if strWhere = "" then
 			 strWhere = strWhere & "Jaargang LIKE '%" & Jaargang & "%' "
 		  else
 			 strWhere = strWhere & "and Jaargang LIKE '%" & Jaargang & "%' "		
 		  end if
 	  end if
 	  
 	  If  Uitgever <> "" Then
 		  if strWhere = "" then
 			 strWhere = strWhere & "Uitgever LIKE '%" & Uitgever & "%' "
 		  else
 			 strWhere = strWhere & "and Uitgever LIKE '%" & Uitgever & "%' "		
 		  end if
 	  end if
 	  
 	  If  Bijzonderheden <> "" Then
 		  if strWhere = "" then
 			 strWhere = strWhere & "Bijzonderheden LIKE '%" & Bijzonderheden & "%' "
 		  else
 			 strWhere = strWhere & "and Bijzonderheden LIKE '%" & Bijzonderheden & "%' "		
 		  end if
 	  end if
 	  
 
 		  if strWhere = "" then
 			 strWhere = strWhere & "Categorie LIKE '%" & Cat("Categorie") & "%' "
 		  else
 			 strWhere = strWhere & "and Categorie LIKE '%" & Cat("Categorie") & "%' "		
 		  end if
 
 	  If Nummer <> "" Then
 		  if strWhere = "" then
 			 strWhere = strWhere & "Nummer LIKE '%" & Nummer & "%' "
 		  else
 			 strWhere = strWhere & "and Nummer LIKE '%" & Nummer & "%' "		
 		  end if
 		  
 	  end if
 	  
 	  strSql = strSql & strWhere & ";"
 '-----------------------------   
 	  Counter.Open strSql, conn
 	  '"SELECT COUNT(*) AS TellerVan FROM Boeken WHERE Titel LIKE '%" & Titel & "%' and Ondertitel LIKE '%" & Ondertitel & "%' and Auteur LIKE '%" & Auteur & "%' and Jaar LIKE '%" & Jaar & "%' and Jaargang LIKE '%" & Jaargang & "%' and Uitgever LIKE '%" & Uitgever & "%' and Bijzonderheden LIKE '%" & Bijzonderheden & "' and Categorie LIKE '" & Request("cmbCategorie") & "%' and Nummer LIKE '%" & Nummer & "%';", Conn
 
    Set Counter2 = Server.CreateObject("ADODB.recordset")
 	   Counter2.Open "SELECT COUNT (*) AS TellerTot FROM Boeken;", Conn
   %>
  Er zijn <b><%Response.Write(Counter("TellerVan"))%></b> van de <b><%Response.Write(Counter2("TellerTot"))%></b> resultaten gevonden die aan uw zoekcriteria voldoen.
   <br><br><br>
   <table width="95%" border="0" cellpadding="0" cellspacing="0">
   
   <%
 
    Set Results = Server.CreateObject("ADODB.recordset")
   
 	'Dim strSql
 	'Dim strWhere
 	  strWhere = ""
 	  
 	  strSql = "SELECT * FROM Boeken WHERE "
   
 	  If Titel <> "" Then
 			 strWhere = strWhere & "Titel LIKE '%" & Titel & "%' "
 	  end if	
   
 	  If Ondertitel <> "" Then
 		  if strWhere = "" then
 			 strWhere = strWhere & "Ondertitel LIKE '%" & Ondertitel & "%' "
 		  else
 			 strWhere = strWhere & "and Ondertitel LIKE '%" & Ondertitel & "%' "		
 		  end if
 	  end if
   
 	  If Auteur <> "" Then
 		  if strWhere = "" then
 			 strWhere = strWhere & "Auteur LIKE '%" & Auteur & "%' "
 		  else
 			 strWhere = strWhere & "and Auteur LIKE '%" & Auteur & "%' "		
 		  end if
 	  end if
 	  
 	  If Jaar <> "" Then
 		  if strWhere = "" then
 			 strWhere = strWhere & "Jaar LIKE '%" & Jaar & "%' "
 		  else
 			 strWhere = strWhere & "and Jaar LIKE '%" & Jaar & "%' "		
 		  end if
 	  end if
 	  
 	  If Jaargang <> "" Then
 		  if strWhere = "" then
 			 strWhere = strWhere & "Jaargang LIKE '%" & Jaargang & "%' "
 		  else
 			 strWhere = strWhere & "and Jaargang LIKE '%" & Jaargang & "%' "		
 		  end if
 	  end if
 	  
 	  If  Uitgever <> "" Then
 		  if strWhere = "" then
 			 strWhere = strWhere & "Uitgever LIKE '%" & Uitgever & "%' "
 		  else
 			 strWhere = strWhere & "and Uitgever LIKE '%" & Uitgever & "%' "		
 		  end if
 	  end if
 	  
 	  If  Bijzonderheden <> "" Then
 		  if strWhere = "" then
 			 strWhere = strWhere & "Bijzonderheden LIKE '%" & Bijzonderheden & "%' "
 		  else
 			 strWhere = strWhere & "and Bijzonderheden LIKE '%" & Bijzonderheden & "%' "		
 		  end if
 	  end if
 	  
 	if Request("cmbCategorie") <> "" then '-->
 		  if strWhere = "" then
 			 strWhere = strWhere & "Categorie LIKE '%" & Cat("Categorie") & "%' "
 		  else
 			 strWhere = strWhere & "and Categorie LIKE '%" & Cat("Categorie") & "%' "		
 		  end if
 	end if		  '-->
 
 	  If Nummer <> "" Then
 		  if strWhere = "" then
 			 strWhere = strWhere & "Nummer LIKE '%" & Nummer & "%' "
 		  else
 			 strWhere = strWhere & "and Nummer LIKE '%" & Nummer & "%' "		
 		  end if
 		  
 	  end if
 	  
 	  strSql = strSql & strWhere & ";"
   
 	  Results.Open strSql, conn
   %>
   
 
    <tr>
 	   <td width="306" height="2" colspan="4" bgcolor="#960000">
 	   </td>
 	  </tr>
 	  
 	  <tr>
 	   <td colspan="4" height="45" valign="bottom">
 	  <font color="#960000"><h4><%=Results("Categorie") %></h4></font></td>
 	  </tr>
 	  
 	<tr>
 		
 	  <td width="8%" height="20" valign="top"><font color="#888888"><b>Nr.</b></font></td>
 	  
 		<% if Results("Categorie") = "Revue der Sporten" OR Results("Categorie") = "Sport in Beeld" OR Results("Categorie") = "plaatjesalbums" then %> 
 			<td width="40%" height="20" valign="top"><font color="#888888"><b>Album</b></font></td>
 			<% else %> 
 			<td width="40%" height="20" valign="top"><font color="#888888"><b>Titel</b></font></td>
 		<% end if %>
 		
 		<% if Results("Categorie") = "Revue der Sporten" OR Results("Categorie") = "Sport in Beeld" OR Results("Categorie") = "tijdschriften" then %> 
 			<td width="32%" height="20" valign="top"><font color="#888888"><b>Jaargang</b></font></td>
 			<% Elseif Results("Categorie") = "plaatjesalbums" then %>
 			<td width="32%" height="20" valign="top"><font color="#888888"><b>Serie</b></font></td>
 			<% Elseif Results("Categorie") <> "" then %>
 			<td width="32%" height="20" valign="top"><font color="#888888"><b>Ondertitel</b></font></td>
 		<% end if %>
 		
 		<% if Results("Categorie") = "tijdschriften" then %> 
 			<td width="20%" height="20" valign="top"><font color="#888888"><b>Nummer</b></font></td>
 			<% Elseif Results("Categorie") = "Revue der Sporten" OR Results("Categorie") = "Sport in Beeld" then %>
 			<td width="20%" height="20" valign="top"><font color="#888888"><b>Uitgever</b></font></td>
 			<% Elseif Results("Categorie") = "plaatjesalbums" then %>
 			<td width="20%" height="20" valign="top"><font color="#888888"><b>Plaatjes</b></font></td>
 			<% Elseif Results("Categorie") <> "" then %>
 			<td width="20%" height="20" valign="top"><font color="#888888"><b>Auteur</b></font></td>
 		<% end if %>
 
   <%
 	While Not Results.EOF
   %>
   
 	<tr>
 			 <td width="8%" valign="top"><font color="#960000"><%=Results("Nummer")%><font color="#960000"></td>
 			 
 			  <td width="40%" valign="top"><a href="index.asp?Pagina=boek&Nummer=<%=Results("Nummer")%>" target="_self"><%=Results("Titel")%></a><br><br></td>
 
 		<% if Results("Ondertitel") <> "" then %> 
 			<td width="32%" valign="top"><%=Results("Ondertitel")%><br><br></td>
 			<% else %> 
 			<td width="32%" valign="top"><%=Results("Jaargang")%><br><br></td>
 		<% end if %>
 
 		<% if Results("Auteur") <> "" then %> 
 			<td width="20%" valign="top"><%=Results("Auteur")%><br><br></td>
 			<% else %>
 			<td width="20%" valign="top"><%=Results("Druk")%><br><br></td>
 		<% end if %>
 
 	</tr>
   
   <%
    Call Results.MoveNext()
    Wend
   %>
   
 	  <tr>
 			<td>&nbsp;</td>
 	  </tr>
   
   <%
    Results.Close
   %>
   
    </table>
    <br>
   Klik <a href="#" onclick="history.go(-1)" alt="Ga terug">hier</a> om terug te gaan
   <br><br>
   <%
 
    Counter.Close
    Counter2.Close
    Conn.Close
   %>
   
   <%
   End If
   %>
 

Reply With Quote
  #25  
Old January 17th, 2005, 07:18 AM
stensol stensol is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: Netherlands
Posts: 28 stensol User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 9 m 10 sec
Reputation Power: 0
Hi Jako,

Thanks for helping me with my final problem, now everything works. Tested with several search-commands, and all results match fine, and also the counter does its work nice.

I also had to change two things in your script, as when I selected just a category from the box, it wouldn't give any results of that category. So I did the following:

Changed these:
Code:
 **************************************************  *******************
      if strWhere = "" then
      strWhere = strWhere & "Categorie LIKE '%" & Cat("Categorie") & "%' "
      else
      strWhere = strWhere & "and Categorie LIKE '%" & Cat("Categorie") & "%' 
 "
      end if
 **************************************************  *******************
   if Request("cmbCategorie") <> "" then '-->
      if strWhere = "" then
      strWhere = strWhere & "Categorie LIKE '%" & Cat("Categorie") & "%' "
      else
      strWhere = strWhere & "and Categorie LIKE '%" & Cat("Categorie") & "%' 
 "
      end if
   end if    '-->
 **************************************************  *******************
 
 Into those:
 **************************************************  *******************
      if strWhere = "" then
      strWhere = strWhere & "Categorie LIKE '%" & Request("cmbCategorie") & 
 "%' "
      else
      strWhere = strWhere & "and Categorie LIKE '%" & Request("cmbCategorie") 
 & "%' "
      end if
 **************************************************  *******************
   if Request("cmbCategorie") <> "" then '-->
      if strWhere = "" then
      strWhere = strWhere & "Categorie LIKE '%" & Request("cmbCategorie") & 
 "%' "
      else
      strWhere = strWhere & "and Categorie LIKE '%" & Request("cmbCategorie") 
 & "%' "
      end if
   end if    '-->
 **************************************************  *******************
 


Best regards,
Bart Stens

Last edited by Shadow Wizard : January 17th, 2005 at 04:24 PM. Reason: added code tags around code - please do it yourself next.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingCode Bank > <% Response.Write %> into <% Response.Write %>


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
Stay green...Green IT