Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need help with sql issue

Status
Not open for further replies.

1712

Technical User
Nov 8, 2000
66
0
0
NL
I had a developer write this code. The resulting recordset is zero records. I know the data is there because I took out everything so it simply did a select * from the db and it displayed the records. I also know the fields for nanny_status and the city_filter have valid criteria because I did a response.write on the string variable str_filter and they showed the correct values as well as being in the access database.

below is the code: can you see anything wrong the sections pertaining to the str_filter.

<form name='filter_list' method=get action=&quot;preview_list.asp&quot;>
<input type=&quot;hidden&quot; name=&quot;filter&quot; value=&quot;<%= request(&quot;filter&quot;) %>&quot;>
Filter by City: <select name='city_filter'>
<option>Tampa</option>
<option>Orlando</option>
<option>Sarasota</option>
</select> <input type=&quot;submit&quot; value=&quot;Filter&quot;>
</form>
<h2>Nanny List</h2>
<!-- This includes the DATABASE MAPPING file -->
<!-- #include file = &quot;mapdb.asp&quot; -->
<%
' Query the database and create a recordset
str_filter = &quot;&quot;

if (request(&quot;filter&quot;) <> &quot;&quot;) then
str_filter = &quot; WHERE nanny_status = '&quot; & request(&quot;filter&quot;) & &quot;'&quot;
if (request(&quot;city_filter&quot;) <> &quot;&quot;) then
str_filter = str_filter & &quot; AND Department = '&quot; & request(&quot;city_filter&quot;) & &quot;'&quot;
end if
end if


sqlstr = &quot;SELECT * FROM nanny&quot; & str_filter


SET rs = Conn.Execute(sqlstr)
WHILE NOT rs.eof
%>
 
Did you do a response.write on sqlstr?

sqlstr = &quot;SELECT * FROM nanny&quot; & str_filter
response.write(sqlstr)
response.end

Also, many inconsistancies with quotes ie.
<form name='filter_list' method=get action=&quot;preview_list.asp&quot;>

single,none,double.

Just a picadillo (is that how you spell it?) of mine. It's a little sloppy. Makes me wonder what mapdb.asp looks like.

 
I think your request(&quot;...&quot;) need to be changed to request.querystring(&quot;...&quot;) for a GET form or request.form(&quot;...&quot;) for a POST form. I think you are getting empty strings for them as written.

i.e. request(&quot;filter&quot;) needs to be changed to
request.querystring(&quot;filter&quot;) or
request.form(&quot;filter&quot;)

 
Thanks for replying. Apparently the code was correct after all. I tried to wtppro the db to the host server and did not have any errors that it did not copy so I assumed I had good data. I copied it again and this time I got good results. Thanks for your help anyway.
 
1712

future reference. you cannot have the DB open when you FTP it. I'm sure that is why it did not send it over

_____________________________________________________________________
[sub]You can accomplish anything in life, provided that you do not mind who gets credit.
Harry S. Truman[/sub]
onpnt2.gif

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top