Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Feb 2005
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Marking a dynamic table row as 'sold' and disabling its links

    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 -
    oRS.moveFirst
    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"
    else
    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%>
    </div></td>
    </tr>
    <%
    oRS.MoveNext
    loop
    %>

  • #2
    Senior Coder TheShaner's Avatar
    Join Date
    Sep 2005
    Location
    Orlando, FL
    Posts
    1,126
    Thanks
    2
    Thanked 40 Times in 40 Posts
    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.

    Like:

    Code:
    <% 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.

    -Shane

  • #3
    New Coder
    Join Date
    Feb 2005
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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).
    M

  • #4
    New Coder
    Join Date
    Feb 2005
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #5
    Senior Coder TheShaner's Avatar
    Join Date
    Sep 2005
    Location
    Orlando, FL
    Posts
    1,126
    Thanks
    2
    Thanked 40 Times in 40 Posts
    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.

    -Shane

  • #6
    New Coder
    Join Date
    Feb 2005
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #7
    Senior Coder TheShaner's Avatar
    Join Date
    Sep 2005
    Location
    Orlando, FL
    Posts
    1,126
    Thanks
    2
    Thanked 40 Times in 40 Posts
    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.

    Example:
    Code:
    <%
    rs.close
    dbConn.close
    Set rs =Nothing
    Set dbConn = Nothing
    %>
    -Shane


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •