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
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