View Full Version : Marking a dynamic table row as 'sold' and disabling its links

Marcus Dunkus
09-22-2005, 10:08 AM
Hi guys,
I have this dynamic table (below) and the boss has asked me to leave sold items there, mark them as 'sold' and disable the relevent links.
I have a yes/no column called 'sold' in the database to provide the info but now I'm stuck. here's the code, Thanks.
'connection bit then -
Do while not oRS.eof

ID = oRS("ID")
thumbnail = oRS("thumbnail")
make = oRS("make")
model = oRS("model")
cardescription = oRS("cardescription")
price = oRS("price")
url = oRS("url")

if cellCol = "FFFFFF" then
cellCol = "C5D2E0"
cellCol = "FFFFFF"
end if
<td width="100" height="70" bgcolor=#<%=cellCol%>><a href= "car/car_details/<%=url%>"><img src="car/car_thumbnails/<%=thumbnail%>" name="Image1" width="100" height="70" border="0" id="Image1"></a></td>
<td width="120" height="70" bgcolor=#<%=cellCol%>><div align="center" class="tablepadding"><%=make%></div></td>
<td width="120" height="70" bgcolor=#<%=cellCol%>><div align="center" class="tablepadding"><%=model%></div></td>
<td width="360" height="70" bgcolor=#<%=cellCol%>><span class="tablepadding"><%=cardescription%><a href="car/car_details/<%=url%>" class="links"> more...</a></span></td>
<td width="60" height="70" bgcolor=#<%=cellCol%>><div align="center" class="tablepadding"><%=price%>

09-22-2005, 03:23 PM
Just include an if...then statement checking if the car is sold and then if it is, don't display the link. Easy as that.


<% If sold = "yes" Then %>
<td width="100" height="70" bgcolor=#<%=cellCol%>><img src="car/car_thumbnails/<%=thumbnail%>" name="Image1" width="100" height="70" border="0" id="Image1"></td>
<% Else %>
<td width="100" height="70" bgcolor=#<%=cellCol%>><a href= "car/car_details/<%=url%>"><img src="car/car_thumbnails/<%=thumbnail%>" name="Image1" width="100" height="70" border="0" id="Image1"></a></td>
<% End If %>

I used the If sold = "yes" that you used in another post of yours about nested ASP tags. Anyway, I'm sure you can come up with a way of displaying the word "SOLD" somewhere too that should be pretty easy to do.


Marcus Dunkus
09-22-2005, 05:49 PM
Thanks, I did it that way and added a flash graphic in a layer to stamp over the image with 'sold'. this was working fine while the variable 'sold' was hard coded to yes. but when I added the yes/no column to the database and hooked up to it, it appears to not recognise it. is this common? is there a more reliable way to set a variable in an Access database (spit).

Marcus Dunkus
09-22-2005, 05:59 PM
just discovered the answer to my own question...I think.
I went into the database and changed the yes/no column to type:text
it's also case sensitive but I had already covered that base.
Thanks guys

09-22-2005, 06:35 PM
Access recognizes the yes/no data type with values of true or false, 1 or -1, and 1 or 0 (I think 1 and 0 work). So the variable needed to be of those values to be recognized by Access for the yes/no data type. But text will work too, hehe. Glad you figured it out.


Marcus Dunkus
09-22-2005, 07:06 PM
ah ha.
new problem tho'
The database seems to have suddenly decided not to accept requests for data in quick succession
If you go to http://www.candlemine.com/forecourt-cars2.asp it will work but if you click on the others or press refresh to see it again it gives an error. The error occurs on the line of code which opens the connection to the database.
But it worked before and nothing has changed as far as I know except I added another column (sold column)
Any ideas?

I need to add some code to release the server when the page has loaded but that has never been there and it worked before.

09-22-2005, 07:28 PM
Yeah, I see that. I think someone a bit more knowledgeable than me may be able to help you. But to me, it seems that maybe it's having a problem connecting to the database if it hasn't been closed. At the end of your code for the page, did you close each connection to the recordsets and database? Go ahead and also set the variables that are set to those recordsets and the database to Nothing. If you did all this, that is where my helpfulness runs out, haha.


Set rs =Nothing
Set dbConn = Nothing