 |
| Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

March 22nd, 2004, 05:14 PM
|
|
Authorized User
|
|
Join Date: Nov 2003
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for your response.
I read carefully your instructions.
So I think is a good idea to make a message be displayed in case one record is missing.
I would like to have your help at this last part of my task.
Do you suggest to select once again the table, then go to apply the server behavior 'show region when recordset is empty'. But where should I place the message? Where on the code of page?
Here is the new code with the ''show region when recordset is not empty' behavior applied.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1253"%>
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.QueryString("Id") <> "") Then
Recordset1__MMColParam = Request.QueryString("Id")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_dytika29_STRING
Recordset1.Source = "SELECT * FROM 29articles WHERE Id = " + Replace(Recordset1__MMColParam, "'", "''") + ""
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
<html>
<head>
<title>29 ÃÃÃÃÃÃ - ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃ</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1253">
<meta name="" content="ÃéôùëïáêáñÃáÃÃá, Ãåóïëüããé, ÃãñÃÃéï, Ãáýðáêôïò, ÃüÃéôóá, Ãìöéëï÷Ãá. à ÃéôùëïáêáñÃáÃéêà Ãéêôõáêà Ãýëç Ã
ÃçìÃñùóçò, åéäÃóåéò, ôïðéêà ÃÃá, ðëçñïöüñçóç. ÃëåêôñïÃéêà åöçìåñÃäá. ÃëåêôñïÃéêà Ãýëç. Internet . Portal. ">
<meta name="keywords" content="ÃéôùëïáêáñÃáÃÃá, Ãåóïëüããé, ÃãñÃÃéï, Ãáýðáêôïò, ÃüÃéôóá, Ãìöéëï÷Ãá, Ã÷åëþïò, Ã
ýçÃïò, ëéìÃïèÃëáóóá, Ãñé÷ùÃÃäá, ÃÃñìï, ÃáõðáêôÃá, Ãéôùëéêü, Portal, Ã
ÃçìÃñùóç, åéäÃóåéò, ÃÃá, ðëçñïöüñçóç" />
</head>
<style>
<!--
a{
text-decoration:none;
line-height: 1px;
font-family: Arial, Helvetica, sans-serif;
font-size: 9px;
}
//-->
</style>
<SCRIPT LANGUAGE="JavaScript">
<!--PRINT
<!-- Begin
function printWindow() {
bV = parseInt(navigator.appVersion);
if (bV >= 4) window.print();
}
// End -->
</script>
<body text="#000000" link="#000000" vlink="#000000" alink="#000000" leftmargin="0" topmargin="0">
<style>
<!--
a{text-decoration:none}
//-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function click(e){if (document.all) if (event.button == 2) return false;if
(document.layers) if (e.which == 3) return false;}
function click2(){event.returnValue=false;return false;}if (document.layers)
document.captureEvents(Event.MOUSEDOWN);document.o nmousedown=click;document.oncontextmenu=click2;
// --> </script>
<script language="JavaScript1.2">
//Disable
function disableselect(e){
return
}
function reEnable(){
return
}
//if IE4+
document.onselectstart=new Function ("return false")
//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
</script>
<% If Not Recordset1.EOF Or Not Recordset1.BOF Then %>
<table border="0" align="left" cellspacing="0">
<tr bordercolor="#111111" bgcolor="#FFFFFF">
<td height="104" valign="top" bgcolor="#fcfcfc"><img src="main/nav/graphic/logo.jpg" width="130" height="120">
<td width="523" height="104" rowspan="1" bgcolor="#fcfcfc" class="text8pt"><p align="center"><img border="0" src="main/nav/graphic/lor1.jpg" width="520" height="10"><img border="0" src="main/nav/graphic/Upframe.jpg" width="520" height="50"><span style="letter-spacing: 1"></span><img border="0" src="main/nav/graphic/lor2.jpg" width="521" height="10">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://active.macromedia.com/flash4/cabs/swflash.cab#version=4,0,0,0" width="520" height="16">
<param name="quality" value="High">
<param name="bgcolor" value="FFFFFF">
<param name="_cx" value="17145">
<param name="_cy" value="476">
<param name="FlashVars" value="-1">
<param name="Src" value="main/nav/graphic/Rotating.swf">
<param name="WMode" value="Window">
<param name="Play" value="-1">
<param name="Loop" value="0">
<param name="SAlign" value>
<param name="Menu" value="-1">
<param name="Base" value>
<param name="Scale" value="ShowAll">
<param name="DeviceFont" value="0">
<param name="EmbedMovie" value="0">
<param name="SWRemote" value>
<embed src="main/nav/graphic/Rotating.swf"
width="520" height="16" quality="high" bgcolor="#FFFFFF"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"> </embed>
</object>
</p></td>
<td width="138" rowspan="1" bgcolor="#fcfcfc" class="text8pt"><img src="main/nav/graphic/logo-deji5.jpg" width="130" height="120"></td>
</tr>
<tr>
<td width="130" rowspan="4" valign="top" bgcolor="#f2f2ff"><div align="center">
<div align="right">
<p> </p>
<p align="center"><span class="cat"><a href="index.asp">ÃÃÃÃÃÃ ÃÃ
ÃÃÃÃ </a></span></p>
<table width=125 height="70" cellpadding=0 cellspacing=0 bgcolor=white>
<tr>
<td width="121" height="40" valign="top" bgcolor="#EEEEEE"><p style=" margin-left:3px; margin-bottom: -20" class="cat">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="115" height="70">
<param name="movie" value="main/nav/graphic/29banner2.swf">
<param name="quality" value="high">
<embed src="main/nav/graphic/29banner2.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="115" height="70"></embed>
</object>
</p></td>
</tr>
</table>
<table width=125 height="70" cellpadding=0 cellspacing=0 bgcolor=white>
<tr>
<td width="121" height="40" valign="top" bgcolor="#EEEEEE"><p style=" margin-left:3px; margin-bottom: -20" class="cat">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="115" height="70">
<param name="movie" value="main/nav/graphic/Tzianos.swf">
<param name="quality" value="high">
<embed src="main/nav/graphic/Tzianos.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="115" height="70"></embed>
</object>
</p></td>
</tr>
</table>
<p> </p>
<p> </p>
</div>
<div align="right">
<p align="center" class="cat" style=" margin-left:3px; margin-bottom: -20"></p>
<p align="center" class="cat" style=" margin-left:3px; margin-bottom: -20"> </p>
</div>
<p></p>
<p> </p>
</div></td>
<td height="34" align="default"><div align="center"><strong><%=(Recordset1.Fields.Item( "Subjectw").Value)%></strong></div></td>
<td width="138" rowspan="4" align="right" valign="top" bgcolor="#f2f2ff"> <p> </p>
<table width=130 height="80" cellpadding=0 cellspacing=0 bgcolor=white>
<tr>
<td width="121" height="40" valign="top" bgcolor="#EEEEEE"><p align="right" class="cat" style=" margin-left:3px; margin-bottom: -20"><a href="main/nav/docs/symmetoxh.htm"><img src="main/nav/graphic/symmetoxh.jpg" width="115" height="70" border="0"></a>
</p>
</td>
</tr>
</table>
<table width=130 height="80" cellpadding=0 cellspacing=0 bgcolor=white>
<tr>
<td width="121" height="40" valign="top" bgcolor="#EEEEEE"><p style=" margin-left:3px; margin-bottom: -20" class="cat">
</p> </td>
</tr>
</table>
<table width=130 height="80" cellpadding=0 cellspacing=0 bgcolor=white>
<tr>
<td width="121" height="40" valign="top" bgcolor="#EEEEEE"><p align="center" class="cat" style=" margin-left:3px; margin-bottom: -20"> </p></td>
</tr>
</table> </td>
</tr>
<tr>
<td height="34" align="default"><div align="center"><img src="<%=(Recordset1.Fields.Item("29Image").Value)% >"></div></td>
</tr>
<tr>
<td width="523" align="default" style="line-height: 150%"><div align="justify">
<p align="justify" class="unnamed1"><%=(Recordset1.Fields.Item("29Con tent").Value)%> </p>
<p align="center" class="unnamed1"> </p>
</div></td>
</tr>
<tr>
<td height="23" align="default"> </td>
</tr>
<tr>
<td height="14" colspan="3" valign="top" bgcolor="#f2f2ff"><table width="795" border="0" align="right" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td align="middle" width="130" bgcolor="#eeeeee"> </td>
<td align="middle" width="190" bgcolor="#eeeeee"> </td>
<td align="middle" width="78" bgcolor="#eeeeee"> </td>
<td align="middle" width="46" bgcolor="#eeeeee">
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
</td>
<td align="middle" width="213" bgcolor="#eeeeee"><!IMG HEIGHT=20 WIDTH=80 SRC="/global/advs/80x20/" BORDER=0></td>
<td align="middle" width="138" bgcolor="#eeeeee"><!IMG HEIGHT=20 WIDTH=80 SRC="/global/advs/80x20/" BORDER=0></td>
</tr>
<tr bgcolor="#333366">
<td height="10" colspan="6">
<p align="center"
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; MARGIN-LEFT: 10px; COLOR: white; FONT-FAMILY: Tahoma">Copyright © 2002-2003-2004 - something </p></td>
</tr>
</tbody>
</table></td>
</tr>
</table>
<% End If ' end Not Recordset1.EOF Or NOT Recordset1.BOF %>
<p> </p>
<p> </p>
</body>
</html>
|
|

March 22nd, 2004, 05:29 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Didn't I say that in my previous message? Maybe you didn't understand... And maybe I confused things with this:
... This table is shown when the recordset is empty
while I meant this:
... This table is shown when the recordset is Not empty
Anyway, this is what I proposed:
What I would do, and suggested before, is to add some sort of error message, at the bottom (or any other location) of the page. Something like this:
Code:
<body>
<ServerBehavior type="Show Region If Recordset Is Not Empty">
<table>
... This table is shown when the recordset is Not empty
</table>
</ServerBehavior>
<ServerBehavior type="Show Region If Recordset Is Empty">
Hi there, and welcome to my site.
The article you're trying to request does no longer exist? Why don't you try our search page or our home page instead?
</ServerBehavior>
</body>
If you look at the pseudo code I posted, things become clearer (I hope). I suggested to wrap the entire table you currently have in your <body> inside the Show Region If Recordset Is Not Empty behavior.
From what I can see you managed to do that just fine.
The next step (the fake XML tag: <ServerBehavior type="Show Region If Recordset Is Empty">), is to add the region after that table. Just right before the closing </body> tag, type a message in plain text / html, select it and apply the server behavior.
Does that help?
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

March 23rd, 2004, 12:37 PM
|
|
Authorized User
|
|
Join Date: Nov 2003
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for your response
I write the phrase 'Data Missing' at the end of the code of the page. I select it, the I apply the 'show recordset if region is empty'. Then the code transforms to this:
<% If Recordset1.EOF And Recordset1.BOF Then %>
Data Missing
<% End If ' end Recordset1.EOF And Recordset1.BOF %>
But then the detail page do not work at all.
This is what I get:
Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required
/1.asp, line 207
where line 207 is the <% If Recordset1.EOF And Recordset1.BOF Then %>
What is this and what I am doing wrong?
Thanks in advance
|
|

March 23rd, 2004, 12:59 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Do you have any code like this:
Set Recordset1 = Nothing?
If so, make sure that code comes last, after your error message.
The recordset needs to be a valid object, if you want to use its EOF and BOF properties.
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|
 |