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:
  #1  
Old January 11th, 2005, 12:21 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
Lightbulb <% Response.Write %> into <% Response.Write %>

Hi guys,

Notice: I'm from The Netherlands, and my English ain't that well, sorry 4 that

I started learning .ASP one week ago, and now I already wrote my own add/modify/delete bookcatalog.

Ofcourse that process didn't go without any problems, I have the following problem now:

I've HTML-cells (<td></td>) in which I want to print values from the database by adding the asp-code "Response.Write". So it now looks like:
*<td> <% = Results("Subtitle") %> </td>*
That piece of code works fine: gets values from pre-defined recordset connected to the Access-database.

But now I want to change that piece of code, so that when the value "Subtitle" in the database is empty (= ""), the code will be changed into:
*<td> <% = Results("Author") %> </td>*


Someone who could help? Shouldn't be that difficult I guess?

Thanx for your help...

Regards,
Bart Stens, Netherlands

Reply With Quote
  #2  
Old January 11th, 2005, 12:27 PM
lewy's Avatar
lewy lewy is offline
Alter Ego Wizard
Click here for more information
 
Join Date: Jun 2004
Location: Edinburg Tx
Posts: 4,392 lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)  Folding Points: 1009 Folding Title: Novice Folder
Time spent in forums: 1 Month 1 Week 2 Days 3 h 42 m 52 sec
Reputation Power: 1608
Use between your <td> tags:
Code:
<% If Results("Subtitle") = "" Then
    Response.Write Results("Author")
      Else
   	Response.Write Results("SubTitle")
      End If %>

Reply With Quote
  #3  
Old January 11th, 2005, 12:56 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
Unhappy won't work

Thanx Lewy, think that code is ok, but my whole code ain't, so below I post it. I marked the important points with red font.

Code:
<%
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
%>


<%
 Call Cat.MoveFirst()
 While Not Cat.EOF

 Set Results = Server.CreateObject("ADODB.recordset")
     Results.Open "SELECT * 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 '" & Cat("Categorie") & "' and Nummer LIKE '%" & Nummer & "%';", Conn

 Call Results.MoveFirst()
     if Results("Titel") = "" then
     else
%>

	
h4><% Response.Write(cat("Categorie")) %></h4>	


<%
 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"><% If Results("Auteur") = "" Then Response.Write Results("Jaargang") Else Response.Write Results("Auteur") End if %></td>
 	 </tr>

<%
 Call Results.MoveNext()
 Wend
%>

<%
   end if
 Call Cat.MoveNext()
 Wend
 Results.Close
%>



Problem is: search results do appear, but the records of which the field "Auteur" in the Access database is empty, just don't appear as a result at all with that code?!?

Plz. help .. (can't find it in my learning .ASP book )

Regards,
Bart Stens

Reply With Quote
  #4  
Old January 11th, 2005, 01:42 PM
lewy's Avatar
lewy lewy is offline
Alter Ego Wizard
Click here for more information
 
Join Date: Jun 2004
Location: Edinburg Tx
Posts: 4,392 lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)  Folding Points: 1009 Folding Title: Novice Folder
Time spent in forums: 1 Month 1 Week 2 Days 3 h 42 m 52 sec
Reputation Power: 1608
Are you getting any error messages? If so, post them.
Try the following instead of your code:
Code:
 
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Provider = "Microsoft.Jet.OLEDB.4.0"
Conn.Open Server.MapPath("Books.mdb")
Set Results = Server.CreateObject("ADODB.recordset")
Set Cat = Server.CreateObject("ADODB.recordset")
Cat.Open "SELECT DISTINCT Categorie FROM Boeken WHERE Categorie LIKE '%" & Request("cmbCategorie") & "%';", Conn
While Not Cat.EOF
	 Results.Open "SELECT * 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 '" & Cat("Categorie") & "' and Nummer LIKE '%" & Nummer & "%';", Conn
	 If Results("Titel") = "" Then
		 %><h4><% Response.Write(cat("Categorie")) %></h4><%
	 Else
		 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"><% If Results("Auteur") = "" Then Response.Write Results("Jaargang") Else Response.Write Results("Auteur") End if %></td>
			</tr>
		 <%
		 Results.MoveNext
		 Wend
		End if
		Results.Close
	 Cat.MoveNext
Wend
%>
 

Last edited by lewy : January 11th, 2005 at 01:53 PM.

Reply With Quote
  #5  
Old January 11th, 2005, 01:53 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 lewy
Are you getting any error messages? If so, post them.


No, that's the whole problem: result is just not visible with script...

You need the database to test?

Regards,
Bart Stens

Reply With Quote
  #6  
Old January 11th, 2005, 01:55 PM
lewy's Avatar
lewy lewy is offline
Alter Ego Wizard
Click here for more information
 
Join Date: Jun 2004
Location: Edinburg Tx
Posts: 4,392 lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)lewy User rank is General 9th Grade (Above 100000 Reputation Level)  Folding Points: 1009 Folding Title: Novice Folder
Time spent in forums: 1 Month 1 Week 2 Days 3 h 42 m 52 sec
Reputation Power: 1608
If you don't mind. I can help you debug.

Reply With Quote
  #7  
Old January 11th, 2005, 02:01 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
Exclamation .zip

I made a .zip-file of the files.

Regards.
Attached Files
File Type: zip search.zip (20.4 KB, 349 views)

Reply With Quote
  #8  
Old January 11th, 2005, 02:08 PM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,193 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: 151652 Folding Title: Super Ultimate Folder - Level 1Folding Points: 151652 Folding Title: Super Ultimate Folder - Level 1Folding Points: 151652 Folding Title: Super Ultimate Folder - Level 1Folding Points: 151652 Folding Title: Super Ultimate Folder - Level 1Folding Points: 151652 Folding Title: Super Ultimate Folder - Level 1Folding Points: 151652 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: 718
Hi,

sorry 2 bother, but was wondering if you could check this out before you go ahead

If you use the like statement, and you don't insert a value, it wont return the records from the database if there is no value in the database field?

ie
Code:
select * from table where name like '%%'

won't return a value if the database fields are empty, because if you use a empty like, it only brings it back if there is a value in the field?

Just a though, I had a similair problem before.

Reply With Quote
  #9  
Old January 11th, 2005, 02:11 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
Short explanation cause most of script is in "Dutch" :

Books.mdb (Access Database)
> use table 'Boeken'
field 'Auteur'
field 'Druk'

** Want to view the value 'Druk' into the "Response.Write" when the field 'Auteur' is empty.


zoek_form.asp (search-form)
not neccesary for debugging


zoek_get.asp (search-script)
to test for the pre-made "empty record" 'Nummer' 154,
zoek_get.asp?cmbCategorie=plaatjesalbums
(should give 3 results: Nummer 154,155,156)

Reply With Quote
  #10  
Old January 11th, 2005, 02:18 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,

sorry 2 bother, but was wondering if you could check this out before you go ahead

If you use the like statement, and you don't insert a value, it wont return the records from the database if there is no value in the database field?

ie
Code:
select * from table where name like '%%'

won't return a value if the database fields are empty, because if you use a empty like, it only brings it back if there is a value in the field?

Just a though, I had a similair problem before.


@Nofriends:

my English ain't that good to understand your post. Do you have a question or do you suggest that the LIKE disrupts the code? and that you don't have an answer cause it's a though problem?

I was thinkin' that maybe set an extra recordset could help???

Regards, Bart

Reply With Quote
  #11  
Old January 11th, 2005, 02:26 PM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,193 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: 151652 Folding Title: Super Ultimate Folder - Level 1Folding Points: 151652 Folding Title: Super Ultimate Folder - Level 1Folding Points: 151652 Folding Title: Super Ultimate Folder - Level 1Folding Points: 151652 Folding Title: Super Ultimate Folder - Level 1Folding Points: 151652 Folding Title: Super Ultimate Folder - Level 1Folding Points: 151652 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: 718
verstaan jy dit beter?

in Afrikaans, almost the same
Wat ek bedoel is, as jy die LIKE gebruik, en daar is geen PARAMATER nie, sal dit nie vir jou 'n record terug bring as die veld in die database leeg is nie, want die like soek 'n value.

in English: :
What I mean is, if you use LIKE and the parameter is empty, it wont return a value if the field in the database is empty.

I ussually check if the paramater is empty and build up the query according to that.

Don't know if that is your problem, just wondering if it won't help

Reply With Quote
  #12  
Old January 11th, 2005, 02:33 PM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,193 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: 151652 Folding Title: Super Ultimate Folder - Level 1Folding Points: 151652 Folding Title: Super Ultimate Folder - Level 1Folding Points: 151652 Folding Title: Super Ultimate Folder - Level 1Folding Points: 151652 Folding Title: Super Ultimate Folder - Level 1Folding Points: 151652 Folding Title: Super Ultimate Folder - Level 1Folding Points: 151652 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: 718
Hi,

i changed the sql statement to:
Code:
Results.Open "SELECT * FROM Boeken WHERE Categorie LIKE '" & Cat("Categorie") & "';", Conn


and used this url
Code:
http://localhost/search/zoek_get.asp?cmbCategorie=plaatjesalbums


and it brought back all 3 results.

So I think it has to do with the like statements

Reply With Quote
  #13  
Old January 11th, 2005, 02:34 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
verstaan jy dit beter?

in Afrikaans, almost the same
Wat ek bedoel is, as jy die LIKE gebruik, en daar is geen PARAMATER nie, sal dit nie vir jou 'n record terug bring as die veld in die database leeg is nie, want die like soek 'n value.

in English: :
What I mean is, if you use LIKE and the parameter is empty, it wont return a value if the field in the database is empty.

I ussually check if the paramater is empty and build up the query according to that.

Don't know if that is your problem, just wondering if it won't help


Your African is good to understand for me, but I just also found out your English post, and YES, with that LIKE-function it won't display the record at all when the field is empty.

I just putted a '_' in the empty databasefield to check if that was the error, and also put that in the script (= "_") and than it does work, but i won't fill all my empty database-fields.

You are talking about a parameter-check and than build up the query. I'm really a newbie to .ASP and Access, but could you try to give me an example or code for that included in my code?

Thnx 4 your good help!

Regards,
Bart

Reply With Quote
  #14  
Old January 11th, 2005, 02:43 PM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,193 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: 151652 Folding Title: Super Ultimate Folder - Level 1Folding Points: 151652 Folding Title: Super Ultimate Folder - Level 1Folding Points: 151652 Folding Title: Super Ultimate Folder - Level 1Folding Points: 151652 Folding Title: Super Ultimate Folder - Level 1Folding Points: 151652 Folding Title: Super Ultimate Folder - Level 1Folding Points: 151652 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: 718
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
  #15  
Old January 11th, 2005, 02:46 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,

i changed the sql statement to:
Code:
Results.Open "SELECT * FROM Boeken WHERE Categorie LIKE '" & Cat("Categorie") & "';", Conn


and used this url
Code:
http://localhost/search/zoek_get.asp?cmbCategorie=plaatjesalbums


and it brought back all 3 results.

So I think it has to do with the like statements


YES, that does work, but one problem: when using the LIKE statement only for the value of 'Categorie', the whole search-form (zoek_form.asp) won't work anymore ofcourse

Because it won't search in the database for LIKE's of the search-command..

how to change that?

Regards,
Bart

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 4 hosted by Hostway
Stay green...Green IT