Forums

This topic is locked

Why this is not working ?

Posted 01 Jul 2001 11:56:39
1
has voted
01 Jul 2001 11:56:39 suhail kaleem posted:
Why this is not working ?


<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/c++.asp" -->
<%
set Recordset1 = Server.CreateObject("ADODB.Recordset"
Recordset1.ActiveConnection = MM_c++_STRING
Recordset1.Source = "SELECT text_intro, tempic FROM tblArticle"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = -1
Dim Repeat1__index
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="846" border="0" cellpadding="0" cellspacing="0">
<tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<td width="846" height="107">
<%

if Recordset1.Fields.Item("tempic".Value <> "" then %>
<img src="<%=(Recordset1.Fields.Item("tempic".Value)%>">
<% Else %>
<img src="<%=(Recordset1.Fields.Item("text_intro".Value)%>">
<% End if %>
</td>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
</tr>
</table>
</body>
</html>
<%
Recordset1.Close()
%>


I want to show a image which is in text-intro--- if the image in the coloum tempic is null.
but the above code shows me the first image in the coloum which is empty
and dont show the rest of the image that have a value in the tempic .

any help ?

suhailkaleem


Replies

Replied 03 Jul 2001 11:01:05
03 Jul 2001 11:01:05 Richard Sloman replied:
I find it helpful at this point to do two things:
Firstly, use a Response.Write rather than UD's <%=blah%>. Don't know why, but it sometimes seems to work when nothing else will. Secondly, do a Response.Write of the recordset field before the <IMG SRC= tag, so you can see exactly what the value of the field is. This should help with debugging the code.

Reply to this topic