OutFront Forums
     Home    Register     Search      Help      Login    

Sponsors
Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax
Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.
Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Follow Us
On Facebook
On Twitter
RSS
Via Email

Recent Posts
Todays Posts
Most Active posts
Posts since last visit
My Recent Posts
Mark posts read

 

Which bit am I missing?

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP, PHP, and Database >> Which bit am I missing?
Page: [1] 2   next >   >>
 
 
Giomanach

 

Posts: 6191
Joined: 11/19/2003
From: England
Status: offline

 
Which bit am I missing? - 2/15/2005 11:32:07   
Some of you will remember my previous question about the if then statement. Moving on from that...

At the moment, I'm just interested in getting the individual queries to run

<%
if Request.QueryString("mode") = "display" then
%>
<br />
<span class="title">Search Results</span>
<br />
<%
'Start Results Display
Response.Write("Your Criteria Returned The Following Matches")

'Grab values from Form
strHeight=Request.Form("height")
strEyeColor=Request.Form("eyecolor")
strHairColor=Request.Form("haircolor")
strLocation=Request.Form("location")
strSexuality=Request.Form("sexuality")
strMarital=Request.Form("marital")
strSex=Request.Form("sex")
strPhoto=Request.Form("chkphoto")

'Holds UserID
Dim UserID

'Open DB Connection
myDSN="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("fpdb\4k7hT6.mdb")

'Retrieve records based on whether Photo Wanted or not
'if strPhoto="ON" then

'ON ERROR RESUME NEXT

'Define Fields to be pulled from DB
strSQL="SELECT UserID, UserName, x_state, x_sex, Comments, x_photo, x_photopres, x_company, x_address FROM Users WHERE x_state=:: strLocation :: AND x_sex=:: strSex :: AND x_company=:: strHairColor :: AND x_address=:: strEyeColor :: AND x_photopres='ON'"

'Open RecordSet
set rsViewProfile = Server.CreateObject("ADODB.Connection")
rsViewProfile.Open myDSN

'Only Uncomment the following if you receive and error about Parameters etc
'rsViewProfile.Execute(strSQL)

Response.Write("<table cellpadding='0' cellspacing='0'>")
Response.Write("<tr>")
Response.Write("<td colspan='2' align='left'>")
Response.Write("<a href=""search.asp?mode=view"" title=""View ")
Response.Write "" & rsViewProfile = "UserName" & ""
Response.Write("'s Profile"">")
Response.Write ""& rsViewProfile = "UserName" & ""
Response.Write("</a>")
Response.Write("</td>")
Response.Write("</tr>")
Response.Write("<tr>")
Response.Write("<td>")
Response.Write("<img src='upload/")
Response.Write"" & rsViewProfile = "x_photo" & ""
Response.Write("' alt='' />")
Response.Write("</td>")
Response.Write("<td>")
Response.Write("Sex: ")
Response.Write"" & rsViewProfile = "x_sex" & ""
Response.Write("</td>")
Response.Write("</tr>")
Response.Write("</table>")

'else
'strSQL="SELECT UserID, UserName, x_state, x_sex, Comments, x_photo, x_company, x_address FROM Users WHERE x_state=:: strLocation :: AND x_sex=:: strSex :: AND x_company=:: strHairColor :: AND x_address=:: strEyeColor :: "
'End if
%>
<table>
<tr>
<td><% %></td>
</tr>
</table>
<% End if %>


I know the fields and whatnot don't quite match up, but every field returns as false. Tested on both IIS5.1 (XP Pro) and IIS6(Windows 2003).

There is a difference though. You;ve probably noticed that I've commented out rsViewProfile.Execute(strSQL). It works with that in on IIS5.1, but not on IIS6, any idea why that would be as well?

TIA

Dan

_____________________________



rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Which bit am I missing? - 2/15/2005 11:47:00   
quote:

...FROM Users WHERE x_state=:: strLocation :: AND x_sex=:: strSex :: AND ...


Are those spaces in there?

:: strLocation :: should be '::strLocation::' if it is a text field. Generally speaking:

'::TextField::'
::NumberField::

That help any?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to Giomanach)
Giomanach

 

Posts: 6191
Joined: 11/19/2003
From: England
Status: offline

 
RE: Which bit am I missing? - 2/15/2005 11:58:09   
quote:

:: strLocation :: should be '::strLocation::'

//Note to self - pay attention to keyboard when typing - I'm a touch typer, unfortunatley, I type without looking at the keyboard, so typos do go amiss...

And unfortunatley, it hasn't altered anything: http://eintroductions.net/search.asp?mode=display

Could it be the way I'm pulling the fields from the form to match the DB?

Previous question: http://www.frontpagewebmaster.com/m-251922/tm.htm - might help a bit

_____________________________




(in reply to rdouglass)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Which bit am I missing? - 2/15/2005 12:29:50   
quote:

WHERE x_state=:: strLocation :: AND


Sorry, didn't even notice you were not using the DRW. Try putting the fields in a Request.form statement like this:

...WHERE (x_state='" & Request.form("strLocation") & "') AND ...

That any better?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to Giomanach)
Giomanach

 

Posts: 6191
Joined: 11/19/2003
From: England
Status: offline

 
RE: Which bit am I missing? - 2/16/2005 7:39:51   
Nope:)

I've gotta be doing something wrong...:)

_____________________________




(in reply to rdouglass)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Which bit am I missing? - 2/16/2005 9:35:34   
Can you post your current code?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to Giomanach)
Giomanach

 

Posts: 6191
Joined: 11/19/2003
From: England
Status: offline

 
RE: Which bit am I missing? - 2/16/2005 9:40:08   
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="01.css" rel="stylesheet" type="text/css" />
<title>eIntroductions :: Search</title>
</head>
<body>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td><img src="images/top_left_main.gif" alt="eIntroductions" /></td>
<td><img src="images/top_left_main_2.gif" alt="eIntroductions" /></td>
<td class="head"><img src="images/top_right_main.jpg" alt="eIntroductions" /></td>
</tr>
</table>
</td>
<tr>
<td class="nav">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td class="navbut"><a href="default.asp" title="Home"><img src="images/template2_1_4_06.gif" alt="Home" /></a></td>
<td class="navbut"><a href="register.asp" title="Register"><img src="images/template2_1_4_07.gif" alt="Register" width="81" height="26" /></a></td>
<td class="navbut"><a href="login.asp" title="Login"><img src="images/template2_1_4_08.gif" alt="Login" width="62" height="26" border="0" /></a></td>
<td class="navbut"><a href="search.asp" title="Search"><img src="images/template2_1_4_09.gif" alt="Search" width="70" height="26" /></a></td>
<td class="navbut"><a href="faq.asp" title="FAQ"><img src="images/template2_1_4_10.gif" alt="FAQ" width="54" height="26" /></a></td>
<td class="nav"></td>
<td class="navbut"><img src="images/template2_1_4_12.gif" alt="eIntroductions" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%" align="center">
<tr>
<td width="150px"></td>
<div align="center">
<%
if Request.QueryString("mode") = "search" then
%>
<td><br /><span class="title">Search</span>
<br />
Find your match, use the search fields below to find them.
<br /><br />
<form action="search.asp?mode=display" method="post">
<table>
<tr>
<td>Location: </td><td><input type="text" name="location" /></td>
</tr>
<tr>
<td>Height: </td>
<td>
<select name="height">
<option selected>---Please Select---</option>
<option value="4'9 or shorter">4'9 or shorter</option>
<option value="5' - 5'5">5' - 5'5</option>
<option value="5'6 - 6'">5'6 -6</option>
<option value="6' or taller">6' or taller</option>
<option value="">Any</option>
</select>
</td>
</tr>
<tr>
<td>Eye Color: </td>
<td>
<select name="eyecolor">
<option selected>---Please Select---</option>
<option value="Blue">Blue</option>
<option value="Brown">Brown</option>
<option value="Green">Green</option>
<option value="Grey">Grey</option>
<option value="">Any</option>
</select>
</td>
</tr>
<tr>
<td>Hair Color: </td>
<td>
<select name="haircolor">
<option selected>---Please Select---</option>
<option value="Blonde">Blonde</option>
<option value="Brown">Brown</option>
<option value="Black">Black</option>
<option value="Red">Red</option>
<option value="Dyed">Dyed</option>
<option value="">Any</option>
</select>
</td>
</tr>
<tr>
<td>Marital Status</td>
<td>
<select name="marital">
<option selected>---Please Select---</option>
<option value="Single">Single</option>
<option value="Married">Married</option>
<option value="Divorced">Divorced</option>
<option value="Widowed">Widowed</option>
<option value="">Any</option>
</select>
</td>
</tr>
<tr>
<td>
Sexuality
</td>
<td>
<select name="sexuality">
<option selected>---Please Select---</option>
<option value="Straight">Straight</option>
<option value="Bi-Sexual">Bi-Sexual</option>
<option value="Gay">Gay</option>
<option value="">Any</option>
</select>
</td>
</tr>
<tr>
<td>Sex</td>
<td>
<select name="sex">
<option selected>---Please Select---</option>
<option value="Male">Male</option>
<option value="Female">Female</option>
<option value="">Any</option>
</select>
</td>
</tr>
<tr>
<td>Photo?</td>
<td><input type="checkbox" name="chkphoto" /></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="Submit" value="Submit" />  <input type="reset" value="Clear" /></td>
</tr>
</table>
</form>
<%
End if
%>
<%
if Request.QueryString("mode") = "display" then
%>
<br />
<span class="title">Search Results</span>
<br />
<%
'Start Results Display
Response.Write("Your Criteria Returned The Following Matches")

'Grab values from Form
strHeight=Request.Form("height")
strEyeColor=Request.Form("eyecolor")
strHairColor=Request.Form("haircolor")
strLocation=Request.Form("location")
strSexuality=Request.Form("sexuality")
strMarital=Request.Form("marital")
strSex=Request.Form("sex")
strPhoto=Request.Form("chkphoto")

'Holds UserID
Dim UserID

'Open DB Connection
myDSN="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("fpdb\4k7hT6.mdb")

'Retrieve records based on whether Photo Wanted or not
'if strPhoto="ON" then

'ON ERROR RESUME NEXT

'Define Fields to be pulled from DB
strSQL="SELECT UserID, UserName, x_state, x_sex, Comments, x_photo, x_photopres, x_company, x_address FROM Users WHERE (x_state='" & Request.form("strLocation") & "') AND (x_sex='" & Request.Form("strSex") & "') AND (x_company='" & Request.Form("strHairColor") & "') AND x_address='::strEyeColor::' AND x_photopres='ON'"

'Open RecordSet
set rsViewProfile = Server.CreateObject("ADODB.Connection")
rsViewProfile.Open myDSN

'Only Uncomment the following if you receive and error about Parameters etc
'rsViewProfile.Execute(strSQL)

Response.Write("<table cellpadding='0' cellspacing='0'>")
Response.Write("<tr>")
Response.Write("<td colspan='2' align='left'>")
Response.Write("<a href=""search.asp?mode=view"" title=""View ")
Response.Write "" & rsViewProfile = "UserName" & ""
Response.Write("'s Profile"">")
Response.Write ""& rsViewProfile = "UserName" & ""
Response.Write("</a>")
Response.Write("</td>")
Response.Write("</tr>")
Response.Write("<tr>")
Response.Write("<td>")
Response.Write("<img src='upload/")
Response.Write"" & rsViewProfile = "x_photo" & ""
Response.Write("' alt='' />")
Response.Write("</td>")
Response.Write("<td>")
Response.Write("Sex: ")
Response.Write"" & rsViewProfile = "x_sex" & ""
Response.Write("</td>")
Response.Write("</tr>")
Response.Write("</table>")

'else
'strSQL="SELECT [Username], [x_state], [x_sex], [Comments],  [x_company], [x_address] from Users WHERE x_state='" & strLocation &"' AND x_sex='" & strSex & "' AND x_company='" & strHairColor & "' AND x_address='" & strEyeColor & "'"
'End if
%>
<table>
<tr>
<td><% %></td>
</tr>
</table>
<% End if %>
</div>
</td>
<td width="150px"></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>


_____________________________




(in reply to rdouglass)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Which bit am I missing? - 2/16/2005 10:38:09   
quote:

strSQL="SELECT UserID, UserName, x_state, x_sex, Comments, x_photo, x_photopres, x_company, x_address FROM Users WHERE (x_state='" & Request.form("strLocation") & "') AND (x_sex='" & Request.Form("strSex") & "') AND (x_company='" & Request.Form("strHairColor") & "') AND x_address='::strEyeColor::' AND x_photopres='ON'"


Making more sense now. Try this:

strSQL="SELECT UserID, UserName, x_state, x_sex, Comments, x_photo, x_photopres, x_company, x_address FROM Users WHERE (x_state='" strLocation & "') AND (x_sex='" & strSex & "') AND (x_company='" & strHairColor & "') AND x_photopres='ON'"

See what I did? I didn't realize you had already put those into variables. That any better?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to Giomanach)
Giomanach

 

Posts: 6191
Joined: 11/19/2003
From: England
Status: offline

 
RE: Which bit am I missing? - 2/16/2005 10:48:12   
I think I'm officially going insane.

Windows Server 2003 Web Edition, IIS6.0, Plesk 7 - Same result, returns all fields as "False"
Windows XP Pro, IIS5.1, No Control Panel:

quote:

Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/Client/Phoenix Web Services/eIntroductions/new/search.asp, line 176, column 131
strSQL="SELECT UserID, UserName, x_state, x_sex, Comments, x_photo, x_photopres, x_company, x_address FROM Users WHERE (x_state='" strLocation & "') AND (x_sex='" & strSex & "') AND (x_company='" & strHairColor & "') AND x_photopres='ON'"
----------------------------------------------------------------------------------------------------------------------------------^


:)

I had orginally tried it in a similar way, just without the enclosing brackets round each value, and that returned the same error.

I wish I had another server to test this on, so I could make sure whether it was me, or my configuration.

And just FTR - I have no modifications done to this machine at the moment, apart from the alteration of the IE Title Bar:)

_____________________________




(in reply to rdouglass)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Which bit am I missing? - 2/16/2005 10:56:07   
quote:

Windows Server 2003 Web Edition, IIS6.0, Plesk 7


I have all that except Plesk. If you would like to PM me for an email address, maybe you could send me a zipped copy of your DB?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to Giomanach)
Giomanach

 

Posts: 6191
Joined: 11/19/2003
From: England
Status: offline

 
RE: Which bit am I missing? - 2/17/2005 7:55:38   
I can safely say, it's neither of us:)

Win2k3, IIS6.0, Plesk7
quote:

Your Criteria Returned The Following Matches
SELECT UserID, UserName, x_state, x_sex, Comments, x_photo, x_company, x_address FROM Users WHERE (x_state='NY') AND (x_sex='Female') AND (x_company='Red')

Microsoft JET Database Engine error '80040e10'

No value given for one or more required parameters.

/search.asp, line 185


XP Pro, IIS5.1
quote:

ADODB.Recordset (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/Client/Phoenix Web Services/eIntroductions/new/search.asp, line 186


:):)

<edit>
Just updated DB, so both are the same, and only results change on XP:

quote:

Microsoft JET Database Engine (0x80040E10)
No value given for one or more required parameters.
/Client/Phoenix Web Services/eIntroductions/new/search.asp, line 185


DB is exactly the same as the copy I sent you
</edit>

< Message edited by Giomanach -- 2/17/2005 8:48:02 >


_____________________________




(in reply to rdouglass)
Giomanach

 

Posts: 6191
Joined: 11/19/2003
From: England
Status: offline

 
RE: Which bit am I missing? - 2/17/2005 11:29:14   
Hate to push, but I do have a deadline for this:)

_____________________________




(in reply to Giomanach)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Which bit am I missing? - 2/17/2005 12:48:18   
Did you get my PM yesterday with the link? What I sent back to you worked fine on one of my servers (Win2K3, IIS6).

Did you try my code?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to Giomanach)
Giomanach

 

Posts: 6191
Joined: 11/19/2003
From: England
Status: offline

 
RE: Which bit am I missing? - 2/17/2005 13:07:01   
Yup, that's what returned the results you see in my previous post. Only bit I altered was to put a line break inbetween the opening line and the results: Response.Write("Your Criteria Returned The Following Matches<br />")

I previously had problems getting Spooky Login to work on the same server too. This is seriously annoying...

My previous attempt at writing this, without Spooky Login also failed. I can get things to work on IIS5.1 (XP Pro), but as soon as I upload to the Win2k3 Server, it all goes pear shaped:)

_____________________________




(in reply to rdouglass)
Spooky

 

Posts: 26723
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Which bit am I missing? - 2/17/2005 13:24:34   
Where abouts are you now with the code?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

Sp:)ky


(in reply to Giomanach)
Giomanach

 

Posts: 6191
Joined: 11/19/2003
From: England
Status: offline

 
RE: Which bit am I missing? - 2/17/2005 13:26:27   
Bout here:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="01.css" rel="stylesheet" type="text/css" />
<title>eIntroductions :: Search</title>
</head>
<body>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td><img src="images/top_left_main.gif" alt="eIntroductions" /></td>
<td><img src="images/top_left_main_2.gif" alt="eIntroductions" /></td>
<td class="head"><img src="images/top_right_main.jpg" alt="eIntroductions" /></td>
</tr>
</table>
</td>
<tr>
<td class="nav">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td class="navbut"><a href="default.asp" title="Home"><img src="images/template2_1_4_06.gif" alt="Home" /></a></td>
<td class="navbut"><a href="register.asp" title="Register"><img src="images/template2_1_4_07.gif" alt="Register" width="81" height="26" /></a></td>
<td class="navbut"><a href="login.asp" title="Login"><img src="images/template2_1_4_08.gif" alt="Login" width="62" height="26" border="0" /></a></td>
<td class="navbut"><a href="search.asp" title="Search"><img src="images/template2_1_4_09.gif" alt="Search" width="70" height="26" /></a></td>
<td class="navbut"><a href="faq.asp" title="FAQ"><img src="images/template2_1_4_10.gif" alt="FAQ" width="54" height="26" /></a></td>
<td class="nav"></td>
<td class="navbut"><img src="images/template2_1_4_12.gif" alt="eIntroductions" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%" align="center">
<tr>
<td width="150px"></td>
<div align="center">
<%
if Request.QueryString("mode") = "search" then
%>
<td><br /><span class="title">Search</span>
<br />
Find your match, use the search fields below to find them.
<br /><br />
<form action="search.asp?mode=display" method="post">
<table>
<tr>
<td>Location: </td><td><input type="text" name="location" /></td>
</tr>
<tr>
<td>Height: </td>
<td>
<select name="height">
<option selected>---Please Select---</option>
<option value="4'9 or shorter">4'9 or shorter</option>
<option value="5' - 5'5">5' - 5'5</option>
<option value="5'6 - 6'">5'6 -6</option>
<option value="6' or taller">6' or taller</option>
<option value="">Any</option>
</select>
</td>
</tr>
<tr>
<td>Eye Color: </td>
<td>
<select name="eyecolor">
<option selected>---Please Select---</option>
<option value="Blue">Blue</option>
<option value="Brown">Brown</option>
<option value="Green">Green</option>
<option value="Grey">Grey</option>
<option value="">Any</option>
</select>
</td>
</tr>
<tr>
<td>Hair Color: </td>
<td>
<select name="haircolor">
<option selected>---Please Select---</option>
<option value="Blonde">Blonde</option>
<option value="Brown">Brown</option>
<option value="Black">Black</option>
<option value="Red">Red</option>
<option value="Dyed">Dyed</option>
<option value="">Any</option>
</select>
</td>
</tr>
<tr>
<td>Marital Status</td>
<td>
<select name="marital">
<option selected>---Please Select---</option>
<option value="Single">Single</option>
<option value="Married">Married</option>
<option value="Divorced">Divorced</option>
<option value="Widowed">Widowed</option>
<option value="">Any</option>
</select>
</td>
</tr>
<tr>
<td>
Sexuality
</td>
<td>
<select name="sexuality">
<option selected>---Please Select---</option>
<option value="Straight">Straight</option>
<option value="Bi-Sexual">Bi-Sexual</option>
<option value="Gay">Gay</option>
<option value="">Any</option>
</select>
</td>
</tr>
<tr>
<td>Sex</td>
<td>
<select name="sex">
<option selected>---Please Select---</option>
<option value="Male">Male</option>
<option value="Female">Female</option>
<option value="">Any</option>
</select>
</td>
</tr>
<tr>
<td>Photo?</td>
<td><input type="checkbox" name="chkphoto" /></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="Submit" value="Submit" />  <input type="reset" value="Clear" /></td>
</tr>
</table>
</form>
<%
End if
%>
<%
if Request.QueryString("mode") = "display" then
%>
<br />
<span class="title">Search Results</span>
<br />
<%
'Start Results Display
Response.Write("Your Criteria Returned The Following Matches<br />")

'Grab values from Form
strHeight=Request.Form("height")
strEyeColor=Request.Form("eyecolor")
strHairColor=Request.Form("haircolor")
strLocation=Request.Form("location")
strSexuality=Request.Form("sexuality")
strMarital=Request.Form("marital")
strSex=Request.Form("sex")
strPhoto=Request.Form("chkphoto")

'Holds UserID
Dim UserID

'Open DB Connection
myDSN="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("fpdb\4k7hT6.mdb")

'Retrieve records based on whether Photo Wanted or not
'if strPhoto="ON" then

'ON ERROR RESUME NEXT

'**************************          RDouglass Started changes here

'Define Fields to be pulled from DB
strSQL="SELECT UserID, UserName, x_state, x_sex, Comments, x_photo, x_company, x_address FROM Users WHERE (x_state='" & strLocation & "') AND (x_sex='" & strSex & "') AND (x_company='" & strHairColor & "')"
Response.write strSQL

'Open RecordSet
set rsViewProfile = Server.CreateObject("ADODB.Connection")
rsViewProfile.Open myDSN

set myTempProfile=rsViewProfile.Execute(strSQL)
myArray = myTempProfile.getrows

rsViewProfile.close

FOR i = 0 to Ubound(myArray,2)

Response.Write("<table cellpadding='0' cellspacing='0'>")
Response.Write("<tr>")
Response.Write("<td colspan='2' align='left'>")
Response.Write("<a href=""search.asp?mode=view"" title=""View ")
'Response.Write "" & rsViewProfile = "UserName" & ""
Response.Write ("&UserName=" & myArray(1,i) & ">")
Response.Write("'s Profile"">")
'Response.Write ""& rsViewProfile = "UserName" & ""
Response.Write(myArray(1,i))
Response.Write("</a>")
Response.Write("</td>")
Response.Write("</tr>")
Response.Write("<tr>")
Response.Write("<td>")
Response.Write("<img src='upload/")
'Response.Write"" & rsViewProfile = "x_photo" & ""
Response.Write(myArray(5,i))
Response.Write("' alt='' />")
Response.Write("</td>")
Response.Write("<td>")
Response.Write("Sex: ")
'Response.Write"" & rsViewProfile = "x_sex" & ""
Response.Write(myArray(3,i))
Response.Write("</td>")
Response.Write("</tr>")
Response.Write("</table>")
NEXT

'************************** RDouglass ended changes here.

'else
'strSQL="SELECT [Username], [x_state], [x_sex], [Comments],  [x_company], [x_address] from Users WHERE x_state='" & strLocation &"' AND x_sex='" & strSex & "' AND x_company='" & strHairColor & "' AND x_address='" & strEyeColor & "'"
'End if
%>
<table>
<tr>
<td><% %></td>
</tr>
</table>
<% End if %>
</td>
<td width="150px"></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>



_____________________________




(in reply to Spooky)
Spooky

 

Posts: 26723
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Which bit am I missing? - 2/17/2005 13:33:50   
and the current error?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

Sp:)ky


(in reply to Giomanach)
Giomanach

 

Posts: 6191
Joined: 11/19/2003
From: England
Status: offline

 
RE: Which bit am I missing? - 2/17/2005 13:39:39   
quote:

Microsoft JET Database Engine error '80040e10'

No value given for one or more required parameters.

/search.asp, line 185


Same servers as last time Spooky:)

<edit>
Line 185:

set myTempProfile=rsViewProfile.Execute(strSQL)

<edit>

< Message edited by Giomanach -- 2/17/2005 13:50:49 >


_____________________________




(in reply to Spooky)
Spooky

 

Posts: 26723
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Which bit am I missing? - 2/17/2005 13:49:43   
and the output of Response.write strSQL ?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

Sp:)ky


(in reply to Giomanach)
Giomanach

 

Posts: 6191
Joined: 11/19/2003
From: England
Status: offline

 
RE: Which bit am I missing? - 2/17/2005 13:52:22   
The strSQL string:

quote:

SELECT UserID, UserName, x_state, x_sex, Comments, x_photo, x_company, x_address FROM Users WHERE (x_state='NY') AND (x_sex='Male') AND (x_company='Red')



<removed URLs>

< Message edited by Spooky -- 2/17/2005 14:32:45 >


_____________________________




(in reply to Spooky)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Which bit am I missing? - 2/17/2005 13:58:51   
All I changed is the section I commented but here's a quick way to fix one of those errors:

'************************** RDouglass Started changes here

IF Request.form("mode") = "search" THEN

'Define Fields to be pulled from DB
.....
.....
Response.Write("</td>")
Response.Write("</tr>")
Response.Write("</table>")
NEXT

END IF

'************************** RDouglass ended changes here.

See the two lines I added. The query was trying to run before any parameters were entered. You probably also ought to fix any Request.form that grabs a text field (unless you're going to force or validate those fields). For instance:

strLocation=Request.Form("location")

might want to be:

IF Request.Form("location")&"" = "" THEN
strLocation = "%"
ELSE
strLocation = trim(Request.Form("location"))
END IF

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to Giomanach)
Spooky

 

Posts: 26723
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Which bit am I missing? - 2/17/2005 14:04:12   
Where does x_photo come from? its not a field in the database?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

Sp:)ky


(in reply to Giomanach)
Giomanach

 

Posts: 6191
Joined: 11/19/2003
From: England
Status: offline

 
RE: Which bit am I missing? - 2/17/2005 14:08:35   
I added it to the DB, for profile photos

_____________________________




(in reply to Spooky)
Spooky

 

Posts: 26723
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Which bit am I missing? - 2/17/2005 14:11:30   
Remove it from the SQL string and try again?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

Sp:)ky


(in reply to Giomanach)
Giomanach

 

Posts: 6191
Joined: 11/19/2003
From: England
Status: offline

 
RE: Which bit am I missing? - 2/17/2005 14:18:24   
quote:

Search Results
Your Criteria Returned The Following Matches
SELECT UserID, UserName, x_state, x_sex, Comments, x_company, x_address FROM Users WHERE (x_state='%') AND (x_sex='%') AND (x_company='%')


ADODB.Recordset error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

/search.asp, line 201


Roger - That just returns a blank page

And there are records in the DB:

:)

_____________________________




(in reply to Spooky)
Spooky

 

Posts: 26723
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Which bit am I missing? - 2/17/2005 14:22:33   
If you want to use a wild card, then you must use "LIKE"
There are no records that exist for "%" and there is no error checking for EOF

SELECT UserID, UserName, x_state, x_sex, Comments, x_company, x_address FROM Users WHERE (x_state LIKE '%') AND (x_sex LIKE '%') AND (x_company LIKE '%')

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

Sp:)ky


(in reply to Giomanach)
Giomanach

 

Posts: 6191
Joined: 11/19/2003
From: England
Status: offline

 
RE: Which bit am I missing? - 2/17/2005 14:28:42   
OK, getting somewhere, it's returning fields, but I do need to ask Roger a Q..

Response.Write ("&UserName=" & myArray(1,i) & ">") - Do I really need the &UserName bit? as it displays that on the title of the link

_____________________________




(in reply to Spooky)
Spooky

 

Posts: 26723
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Which bit am I missing? - 2/17/2005 14:30:35   
Response.Write ( myArray(1,i) & "'s Profile"">")

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

Sp:)ky


(in reply to Giomanach)
Giomanach

 

Posts: 6191
Joined: 11/19/2003
From: England
Status: offline

 
RE: Which bit am I missing? - 2/17/2005 14:31:17   
Thank You!

I both of ya big time now:):)

_____________________________




(in reply to Spooky)
Spooky

 

Posts: 26723
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Which bit am I missing? - 2/17/2005 14:31:59   
Youll also want to replace any quote characters in the before using request.form in the SQL string

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

Sp:)ky


(in reply to Spooky)
Page:   [1] 2   next >   >>

All Forums >> Web Development >> ASP, PHP, and Database >> Which bit am I missing?
Page: [1] 2   next >   >>
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts