Click to See Complete Forum and Search --> : Repear region \no record found problem


alamb200
07-14-2006, 07:26 AM
Hi

I have set up a searchable database with a web front end which works well but I am struggling with setting up a repeat region and what happens if no records are found.

My code is below and the address of the site is http://212.50.191.220 I am fairly new to this and have received lots of help from you all before so thanks for that and please can you help one more time.

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/freqs.asp" -->
<%
Dim freqs__MMColParam
freqs__MMColParam = "1"
If (Request.QueryString("problem") <> "") Then
freqs__MMColParam = Request.QueryString("problem")
End If
%>
<%
Dim freqs
Dim freqs_numRows

Set freqs = Server.CreateObject("ADODB.Recordset")
freqs.ActiveConnection = MM_freqs_STRING
freqs.Source = "SELECT * FROM dbo.faqs WHERE problem LIKE '%" + Replace(freqs__MMColParam, "'", "''") + "%'"
freqs.CursorType = 0
freqs.CursorLocation = 2
freqs.LockType = 1
freqs.Open()

If not freqs.EOF then


%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>



<link rel="stylesheet" type ="text/css"
href="/css/faqs.css" />

<title>FAQ search results</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {color: #0000FF}
-->
</style>
</head>

<body>
<h2 align=center>Knowledgebase search results</h2>
<br /><br />

<table align="center">
<tr>

<th scope="col"><u>Problem ID</u></th>
</tr>
<tr>
<td><center class="style1"><%=(freqs.Fields.Item("id").Value)%></center></td>

</tr>
<tr>

<th scope="col"><u>Problem</u></th>
</tr>
<tr>
<td><center> <%=(freqs.Fields.Item("problem").Value)%> </center></td>

</tr>
<tr>
<th scope="col"><u>Solution</u></th>
</tr>
<tr>
<td> <%=(freqs.Fields.Item("fix").Value)%>
<br /><br />
</td>
</tr>
</table>
<center>
<script language="Jscript">
<!--
// please keep these lines on when you copy the source
// made by: Nicolas - http://www.javascript-page.com

var message = "Print this Page";

function printpage() {
window.print();
}

document.write("<form><input type=button "
+"value=\""+message+"\" onClick=\"printpage()\"></form>");

//-->
</script>
<br />
<script language="Jscript">
<!--
var message = "Close this Page";

function closepage() {
window.close();
}
document.write("<form><input type=button "
+"value=\""+message+"\" onClick=\"closepage()\"></form>");
//-->
</script>
</center>
</body>
</html>

<%
Do while Not freqs.EOF
freqs.Movenext
Loop

Else
Reponse.Redirect("finish.html")
End If

freqs.Close()
Set freqs = Nothing
%>

When I run this with a false entry it tells me it does not like the Response but it looks okay to me.

The repeat region just does not work at all.

Thanks

Anthony

lmf232s
07-14-2006, 08:04 AM
well you misspelled Response.
You have reponse

ANd im not sure what your talking about with the region but if this is the code to
display the region your missing some stuff

Do while Not freqs.EOF
freqs.Movenext
Loop

You need something inside the loop to display the data

Do while Not freqs.EOF
Response.write freqs("Your DB Field Name Goes Here") & "<BR>"
freqs.Movenext
Loop

alamb200
07-14-2006, 08:16 AM
Thanks for that I can't beleive my spelling.
On the repeat region side what is there any way I can get the system to open several pages at a time rather then just showing the single field.
Or if not how would I make the field displayed into a link to the full page.

Thanks

Anthony

alamb200
07-14-2006, 08:59 AM
Hi
I have another idea how it works now is it display a list of problem titles at the bottom of the page under the heading of other possible solutions.

The question is how do I get these to be hyper links and display the correct page?

lmf232s
07-14-2006, 02:15 PM
Again im not sure if this is where you are doing this at so its just a guess
but heres how to do a hyper link

Do while Not freqs.EOF
Response.write "<a href=""SomePage.asp?id=" & freqs("FieldName") & """>" & freqs("Someotherfieldthattellsyouwhereyourgoing") & "</a>"
freqs.Movenext
Loop

or you can switch back to html

Do while Not freqs.EOF
%>
<a href="SomePage.asp?id=<%=freqs("FieldName")%>"><%=freqs("FieldName")%></a>
<%
freqs.Movenext
Loop

alamb200
07-17-2006, 02:49 AM
Hi
Thanks for your help I got it working in the end, I just couldn't get my head around the field I wanted to use.