Results 1 to 5 of 5

Thread: This must be possible, but How?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2002
    Location
    The Twilight Zone
    Posts
    295

    This must be possible, but How?

    I have this code :

    Code:
    <%
    do while not RsNewham.eof
    %>
    <p><%=RsNewham("fieldname2")%></p>
    <p><%=RsNewham("fieldname2")%> </p>
    <%
    RsNewham.movenext
    Loop
    %>
    I can loop through my fields and display the contents that are held in a access DB. The problem is this. I have several recordsets. The user selects which one he wants to search through using a drop down. so i want the code to replace 'RsNewham' with the one that is selected.

    To do this i wrote :

    Code:
    <%
    Dim strSelectedChoice 
    strSelectedhoice = "Rs"+Request.form("select")
    
    do while not StrSelectedChoice.EOF
    %>
    <p><%=StrSelectedChoice("Category")%></p>
    <p><%=StrSelectedChoice("type_of_org")%> </p>
    <%
    StrSelectedChoice.movenext
    Loop
    My above code doesn't work but is it possible to insert the
    recordset name from a form?

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    This must be possible, but How?
    No, its not possible. You use the recordset name being passed as the basis for a new Select statement to create the recordset object.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2002
    Location
    The Twilight Zone
    Posts
    295
    so there's now way to get the details from a form and use that to to select which recordset i want?

  4. #4
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    not like that ..no. Besides from what you are saying, you are persisting recordsets which you should NOT be doing.

    In other words you shouldnt be selecting recordsets from a drop down. You should be selecting string representations of a recordset you want to open. Then detect which was selected by using if statements and opening a recordset based on what was choosen.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  5. #5
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    It might be possible to use the Eval function to do what you want, but I agree with Cander in that there's better ways to do it.

    http://msdn.microsoft.com/library/de.../vsfcteval.asp
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

Posting Permissions

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



Click Here to Expand Forum to Full Width