Page 1 of 2 12 LastLast
Results 1 to 15 of 25

Thread: help! help!

  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    help! help!

    help! help!
    ASP
    the following if loop occurs within an (While NOT RS.EOF ) loop:

    'NULL quotes show as "None"...
    If IsNull(RS("FavoriteQuote")) Then
    Response.Write(" Favorite Quote: None
    ")
    Else
    'All other quotes have font set to background...
    Response.Write(" Favorite Quote:<font color=#000000>" & RS("FavoriteQuote") & "</font>
    ")
    End if

    i can get the individual IF's to run on their own, but not together successfully like i want above. My ELSE condition never runs... well, i mean the text "Favorite Quote" does print out, but the formatted text with the font color is not written to the browser at all....help!

    I've tried all mannyer of things like using but am hung up on this & its driving me crazy.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: help! help!

    I assume your code doesn't really wrap onto a new line like that, or you'd get a VBScript error.

    What do you get if you temporarily change your code to this:

    'NULL quotes show as "None"...
    If IsNull(RS("FavoriteQuote")) Then
    Response.Write "Null"
    Else
    'All other quotes have font set to background...
    Response.Write "Not Null"
    End if

    Do you in fact get all Null? What could this mean? Is your recordset toast? Stuck on a null record and not advancing?

  3. #3
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: help! help!

    Your code works just fine, NULL & NOT NULL is showing up correctly.

    I've gotten quotes to show up as well formatted to the background color, but i've still not been able to get these NOT NULL & NULL values to work together in the same loop.

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: help! help!

    It seems there is no problem with your loop logic if you got Null and Not Null matching with the data, so now I have made some revisions to the statements inside the loop. Try this:

    'NULL quotes show as "None"...
    If IsNull(RS("FavoriteQuote")) Then
    Response.Write " Favorite Quote: None< br >"
    Else
    'All other quotes have font set to background...
    Response.Write " Favorite Quote:<font color=""black"">" & RS("FavoriteQuote") & "</font>< br >"
    End if

    I used double " to get VBScript to write a single " into the HTML, in case that was an issue. (The < br> tags will need their spaces removed.)

  5. #5
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: help! help!

    well it was a nice try but your suggestion gives me the same results as my orig. loop, basically everything works fine except for the ELSE conditon, it will write "Favorite Quote" but will not write the favorite quote text after that formatted to the back ground color.

    here's my code, you can also see below the while loop it lies within:
    ** oh & btw, yes, the funkiness of some of my text below doesn't reflect actual line wraps in my code or anything, its just this board doing some formatting i guess....

    While NOT RS.EOF

    'begin writing the reviews...
    Response.Write(" Title: " & RS("ReviewsTitle") & "
    ")

    'NULL quotes show as "None"...
    If IsNull(RS("FavoriteQuote")) Then
    Response.Write" Favorite Quote: None
    "
    Else
    'All other quotes have font set to background...
    Response.Write" Favorite Quote:<font color=""black"">" & RS("FavoriteQuote") & "</font>
    "
    End if

    'insert a blank line before writing next record...
    Response.Write("
    ")

    'move to the next record...
    RS.MoveNext

    WEnd

    'close the recordset...
    RS.Close
    set RS = Nothing

  6. #6
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: help! help!

    Wait a second. Are you sure that the text isn't there, or, since you are deliberately making it the same color as the page background, is it just not visible? Post a sample of the actual HTML code that is generated by your ASP page. (Due to the board's screening scripts and browser interpretation, this is a little tricky. I recommend you save the resulting ASP page from the browser as HTML, open it in WordPad and resave it as RTF, then post that. It should display as a page of HTML source code. Or, if you have this ASP running on a public server, post the link.) That should shed further light on the matter.

  7. #7
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: help! help!

    setting the background font invisible is different than not having the text written to the browser at all.

    in some minor experiments, the formatted text could indeed be seen by swiping your mouse over the area & that's what i'm trying to accomplish with my loop. What my results are telling me though, is that the favorite quote text is not being written to the browser at all b/c when you swipe the area, nothing is there.
    You comment out parts of my loop and it works though.

    Here's a link, please choose a review & observe the problem results:
    http://www24.brinkster.com/arage/frames.asp

  8. #8
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: help! help!

    hey come on now i'm still stuck!

  9. #9
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: help! help!

    I see some instances of Favorite Quote: None, but I don't see any other Favorite Quotes in the pages I looked at. So this is a different problem than the field data not showing up, the whole line isn't showing up. But when you changed it to Response.Write "Not Null" it did work? I really don't see any explanation for what you've described. Can you post the code for the entire results.asp page?

  10. #10
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: help! help!

    you see no fave quote results written to browser at all b/c I

  11. #11
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: help! help!

    here's my page, hope you can respond before the weekend, some superfulous lines have been deleted to shorten post up, nothing important....

    the commented area near the bottom reflects code that was writing "Favorite Quote" for each record as well as "None" but no Favorite Quote text formatted to the background color.

    <html>

    <head>
    <meta http-equiv="Content-Type"
    content="text/html; charset=iso-8859-1">
    <meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
    <title>chat</title>
    </head>

    <body bgcolor="#000000" text="#008000">

    <p align="center"><font size="5"><u><% =request.form("cmbTitle") %></u>
    Reviews_</font></p>



    <font size="3"><%

    dim myVar
    myVar=request.form("cmbTitle")
    Dim oConn, sConnString, RS
    Set oConn = Server.CreateObject("ADODB.Connection")

    sConnString = "DRIVER={Microsoft Access Driver (*.mdb)};" & "DBQ=" & Server.MapPath("buttdbmunch.mdb") & ";"
    oConn.Open(sConnString)

    set RS = Server.CreateObject("ADODB.Recordset")
    RS.ActiveConnection = sConnString
    RS.Source = "SELECT ReviewsTitle, AuthorName, Rating, ReviewDate, CollectionsTitle, Review, FavoriteQuote FROM qryUpload WHERE ReviewsTitle LIKE '"& myVar & "%' ORDER BY ReviewsTitle"
    RS.Open()

    'when empty recdset write a message...
    If RS.EOF Then
    Response.Write("No reviews in this section.")
    End if

    While NOT RS.EOF

    'begin writing the reviews...
    Response.Write(" Title: " & RS("ReviewsTitle") & "
    ")

    If IsNull(RS("FavoriteQuote"))=true Then
    'NULL quotes show as "None"...
    Response.Write(" Favorite Quote: None
    ")
    else
    'All other quotes have font set to background (black)...
    'Response.Write(" Favorite Quote:" & RS("FavoriteQuote") & "
    ")
    response.write(rs("favoritequote") & "
    ")
    End if

    '----------
    ' If IsNull(RS("FavoriteQuote")) Then
    'NULL quotes show as "None"...
    ' Response.Write(" Favorite Quote: None
    ")
    ' Else
    'All other quotes have font set to background (black)...
    ' Response.Write(" Favorite Quote:<font color=#000000>" & RS("FavoriteQuote") & "</font>
    ")
    ' End if
    '----------

    'insert a blank line before writing next record...
    Response.Write("
    ")

    'move to the next record...
    RS.MoveNext
    WEnd

    'close the recordset...
    RS.Close
    set RS = Nothing

    %></font> </p>



    *</p>
    </body>
    </html>

  12. #12
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: help! help!

    As of tonight, the ELSE loop is writing only the < br > tag. And we know it will write static text. But there is some kind of problem with the RS("FavoriteQuote") part. And I don't see what it is.

    What happens if you change your query string to this, get rid of the loop, and Response.Write RS("FaveQuote")?

    SELECT ReviewsTitle, AuthorName, Rating, ReviewDate, CollectionsTitle, Review, IIf(IsNull([FavoriteQuote]),"None",[FavoriteQuote]) As FaveQuote FROM qryUpload WHERE ReviewsTitle LIKE '"& myVar & "%' ORDER BY ReviewsTitle"

  13. #13
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: help! help!

    sorry for my late response, stuff got in the way but the problem persists & i'm back to re-invigorate the thread.

    i had to reformat your query string a bit to this, mostly add ons of double quotes at start & end

    RS.Source = "SELECT ReviewsTitle, AuthorName, Rating, ReviewDate, CollectionsTitle, Review, IIf(IsNull([FavoriteQuote]),"None",[FavoriteQuote]) As FaveQuote FROM qryUpload WHERE ReviewsTitle LIKE '"& myVar & "%' ORDER BY ReviewsTitle""

    but above gives me an Expected end of statement error in "None" part of your IIF statement, putting ""None"" instead gives an Unterminated string constant error at the end of the entire query string. you can see this error if you visit the site right now.

  14. #14
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: help! help!

    Good catch on the ""None"". Now try removing the extra " at the end.

  15. #15
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: help! help!

    Well, removing the extra " from the end of the query string gives me this error:
    Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
    [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
    /arage/results.asp, line 29

    i get the above errors for this code RS.Open() right after when i set the query string.

    if you'll notice though i think last query suggestion of yours started as SELECT not "SELECT & that's why i added the extra " you asked me to take out. The query string is that supposed to be a string from start to finish, no?

    hey thanks for all your help & staying with me thru it! look forward to your answer!

Page 1 of 2 12 LastLast

Posting Permissions

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