SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Apr 2003
    Location
    SA
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    A little help please...

    Hi
    Here is the code I need some help with.

    'Results' and 'Results2' are what are both variables in
    flash. I can't get both of the results out of the Database
    and diplayed at the same time.

    Thanks


    If oRS.EOF Then
    Response.Write "success=False"
    Else
    Response.Write "success=True&results="
    Do While Not oRS.EOF
    results = results & oRS("Name") & " " & oRS("Surname") & vbCr
    oRS.MoveNext
    Loop
    Response.Write "results2="
    Do While Not oRS.EOF
    results2 = results2 & oRS("Telno") & vbCr
    oRS.MoveNext
    Loop
    End If

    oRS.Close
    Set oRS = Nothing
    oConn.Close
    Set oConn = Nothing

    Response.Write Server.URLEncode(results&results2)

  2. #2
    SitePoint Member
    Join Date
    Apr 2003
    Location
    SA
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nm got it

  3. #3
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Please post the resolution to your problem so that others may benefit. Cheers!
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!

  4. #4
    SitePoint Member
    Join Date
    Apr 2003
    Location
    SA
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If oRS.EOF Then
    Response.Write "success=False"
    Else

    Do While Not oRS.EOF
    name1 = name1 & oRS("Name") & " " & oRS("Surname")

    oRS.MoveNext
    Loop

    End If

    Response.Write "success=True&name1=" & name1
    Response.Write "&telno=" & telno

    oRS.Close
    Set oRS = Nothing
    oConn.Close
    Set oConn = Nothing

    %>

  5. #5
    Just Blow It bronze trophy
    DaveMaxwell's Avatar
    Join Date
    Nov 1999
    Location
    Mechanicsburg, PA
    Posts
    7,268
    Mentioned
    116 Post(s)
    Tagged
    1 Thread(s)
    I don't think that code is going to work quite right for you. If no record is found, the success = true lines will still be written out because they are listed outside the end if.

    Also, what happens if you've got more than one name that meets the criteria? You'll end up with a name like this: John SmithBill JonesWalter BrownMarco Polo. I don't think that's quite what you want. You might want to build some code in to handle that.

    If it can never happen, then you don't need the loop. So your code could look just like this:
    Code:
    If oRS.EOF Then
     Response.Write "success=False"
    Else
     Response.Write "success=True&name1=" & oRS("Name" ) & "%20" & oRS("Surname" )
      Response.Write "&telno=" & telno
    End If
    oRS.Close : Set oRS   = Nothing
    oConn.Close : Set oConn = Nothing
    Dave Maxwell - Manage Your Site Team Leader
    My favorite YouTube Video! | Star Wars, Dr Suess Style
    Learn how to be ready for The Forums' Move to Discourse


Bookmarks

Posting Permissions

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