Dynamic Drop Down (SQL and ASp)

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Dynamic Drop Down (SQL and ASp)

    I developing this web app for our department, I am using FP2002, SQL
    back-end. I have 3 tables in my database at the moment and which it will
    grow to about 10-15 tables in 4 months....Now..

    In my Webform that I need to create a new record for the "Server Matrix", I
    need to pull some info from my tbl_OS and tbl_Staff and I can't seem to be
    able to accomplish this. I have seen many many samples but they all lead to
    the same problem. It looks like I have something extra in my code...Can
    someone help me with this?? The command that is having the problem, ("so I
    think") is the <option></option>, there is (I think) an extra "........


    <%
    Dim DataConn
    Dim CmdPopulateOS
    Dim SQL
    %>
    <%
    Set DataConn=Server.CreateObject("ADODB.Connection")
    Set CmdPopulateOS=Server.CreateObject("ADODB.Recordset ")
    %>
    <%
    DataConn.Open "Driver={SQL
    SERVER};Server=SERVERNAME;UID=USER;pwd=password;Da tabase=SACKBA;"

    SQL = "SELECT * FROM tbl_OS"
    CmdPopulateOS.Open SQL, DataConn
    %>

    <select size="1" name="OS_Version">
    <%while not cmdpopulateOS.eof%>
    <option
    value="<%=CmdPopulateOS("OS_Version")%>"><%=CmdPop ulateOS("OS_Version")%></o
    ption>
    <%
    CmdPopulateOS.MoveNext
    Wend
    %>
    <%
    CmdPopulateOS.Close
    Set CmdPopulateOS=Nothing
    DataConn.Close
    Set DataConn=Nothing
    %>
    </select>


    Ray Medina Guest

  2. Similar Questions and Discussions

    1. Dynamic Drop down DDL - One to Many
      I am looking for either a way to handcode, or an extension which will allow me to create a dynamic drop down using 3 tables. I have downloaded...
    2. dynamic drop downlists in an editable dynamic datagrid.
      How would we address a situation where we have to put dynamic drop downlists in an editable dynamic datagrid. So the scenario is to populate a...
    3. Dynamic Drop-Down Menu
      I am trying to create a page to edit information previously submitted by the user. I cannot figure out how to pre-select the item that the user...
    4. Dynamic ASP Drop Down List
      Hi, I have created a drop down list which is linked to a dataset. Can anyone tell me how I can display 'Please Select' at the top of the drop down...
    5. dynamic drop down
      Yup, and probably best done in Javascript and not PHP :) someone@somedomain.com.invalid wrote: -- MeerKat
  3. #2

    Default Re: Dynamic Drop Down (SQL and ASp)

    What isn't working right? Aside from the normal "how do I make my ASP pages
    more efficient" things, I don't see anything explicitely wrong. ARe you
    getting an error? Are you getting something unexpected? If so, what? What
    do you expect instead? What is appearing as extra? Oh, I see, you think
    there's an extra ".

    This line:
    <option
    value="<%=CmdPopulateOS("OS_Version")%>"><%=CmdPop ulateOS("OS_Version")%></o
    ption>

    should show up like this in a view-source:

    <option value="The value">The Option</option>

    That's fine. Do your values have " in them, by chance?


    <option
    value="<%=SafeOut(CmdPopulateOS("OS_Version"))%>"> <%=SafeOut(CmdPopulateOS("
    OS_Version"))%></option>


    <%

    Function SafeOut(theString)
    SafeOut = Replace(theString, """", "&quot;")
    End Function

    %>

    Ray at work



    "Ray Medina" <compuex@bellsouth.net> wrote in message
    news:uZtTOTH4DHA.416@TK2MSFTNGP10.phx.gbl...
    > I developing this web app for our department, I am using FP2002, SQL
    > back-end. I have 3 tables in my database at the moment and which it will
    > grow to about 10-15 tables in 4 months....Now..
    >
    > In my Webform that I need to create a new record for the "Server Matrix",
    I
    > need to pull some info from my tbl_OS and tbl_Staff and I can't seem to be
    > able to accomplish this. I have seen many many samples but they all lead
    to
    > the same problem. It looks like I have something extra in my code...Can
    > someone help me with this?? The command that is having the problem, ("so I
    > think") is the <option></option>, there is (I think) an extra "........
    >
    >
    > <%
    > Dim DataConn
    > Dim CmdPopulateOS
    > Dim SQL
    > %>
    > <%
    > Set DataConn=Server.CreateObject("ADODB.Connection")
    > Set CmdPopulateOS=Server.CreateObject("ADODB.Recordset ")
    > %>
    > <%
    > DataConn.Open "Driver={SQL
    > SERVER};Server=SERVERNAME;UID=USER;pwd=password;Da tabase=SACKBA;"
    >
    > SQL = "SELECT * FROM tbl_OS"
    > CmdPopulateOS.Open SQL, DataConn
    > %>
    >
    > <select size="1" name="OS_Version">
    > <%while not cmdpopulateOS.eof%>
    > <option
    >
    value="<%=CmdPopulateOS("OS_Version")%>"><%=CmdPop ulateOS("OS_Version")%></o
    > ption>
    > <%
    > CmdPopulateOS.MoveNext
    > Wend
    > %>
    > <%
    > CmdPopulateOS.Close
    > Set CmdPopulateOS=Nothing
    > DataConn.Close
    > Set DataConn=Nothing
    > %>
    > </select>
    >
    >

    Ray at Guest

  4. #3

    Default Re: Dynamic Drop Down (SQL and ASp)

    Ray...thanks for your quick response...but still does not work.

    When I see my page, I get a " in the dropdown and none of my data is
    populating the dropdown. That is the only error I am getting.

    Is there any other way to accomplish this...?




    "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
    news:OTIfRbH4DHA.4084@TK2MSFTNGP11.phx.gbl...
    > What isn't working right? Aside from the normal "how do I make my ASP
    pages
    > more efficient" things, I don't see anything explicitely wrong. ARe you
    > getting an error? Are you getting something unexpected? If so, what?
    What
    > do you expect instead? What is appearing as extra? Oh, I see, you think
    > there's an extra ".
    >
    > This line:
    > <option
    >
    value="<%=CmdPopulateOS("OS_Version")%>"><%=CmdPop ulateOS("OS_Version")%></o
    > ption>
    >
    > should show up like this in a view-source:
    >
    > <option value="The value">The Option</option>
    >
    > That's fine. Do your values have " in them, by chance?
    >
    >
    > <option
    >
    value="<%=SafeOut(CmdPopulateOS("OS_Version"))%>"> <%=SafeOut(CmdPopulateOS("
    > OS_Version"))%></option>
    >
    >
    > <%
    >
    > Function SafeOut(theString)
    > SafeOut = Replace(theString, """", "&quot;")
    > End Function
    >
    > %>
    >
    > Ray at work
    >
    >
    >
    > "Ray Medina" <compuex@bellsouth.net> wrote in message
    > news:uZtTOTH4DHA.416@TK2MSFTNGP10.phx.gbl...
    > > I developing this web app for our department, I am using FP2002, SQL
    > > back-end. I have 3 tables in my database at the moment and which it
    will
    > > grow to about 10-15 tables in 4 months....Now..
    > >
    > > In my Webform that I need to create a new record for the "Server
    Matrix",
    > I
    > > need to pull some info from my tbl_OS and tbl_Staff and I can't seem to
    be
    > > able to accomplish this. I have seen many many samples but they all lead
    > to
    > > the same problem. It looks like I have something extra in my code...Can
    > > someone help me with this?? The command that is having the problem, ("so
    I
    > > think") is the <option></option>, there is (I think) an extra "........
    > >
    > >
    > > <%
    > > Dim DataConn
    > > Dim CmdPopulateOS
    > > Dim SQL
    > > %>
    > > <%
    > > Set DataConn=Server.CreateObject("ADODB.Connection")
    > > Set CmdPopulateOS=Server.CreateObject("ADODB.Recordset ")
    > > %>
    > > <%
    > > DataConn.Open "Driver={SQL
    > > SERVER};Server=SERVERNAME;UID=USER;pwd=password;Da tabase=SACKBA;"
    > >
    > > SQL = "SELECT * FROM tbl_OS"
    > > CmdPopulateOS.Open SQL, DataConn
    > > %>
    > >
    > > <select size="1" name="OS_Version">
    > > <%while not cmdpopulateOS.eof%>
    > > <option
    > >
    >
    value="<%=CmdPopulateOS("OS_Version")%>"><%=CmdPop ulateOS("OS_Version")%></o
    > > ption>
    > > <%
    > > CmdPopulateOS.MoveNext
    > > Wend
    > > %>
    > > <%
    > > CmdPopulateOS.Close
    > > Set CmdPopulateOS=Nothing
    > > DataConn.Close
    > > Set DataConn=Nothing
    > > %>
    > > </select>
    > >
    > >
    >
    >

    Ray Medina Guest

  5. #4

    Default Re: Dynamic Drop Down (SQL and ASp)

    Change the following two lines:
    > > SQL = "SELECT * FROM tbl_OS"
    > > CmdPopulateOS.Open SQL, DataConn
    to be:


    <%
    SQL = "SELECT * FROM tbl_OS"
    CmdPopulateOS.Open SQL, DataConn

    If CmdPopulateOS.Open.EOF then
    Response.Write("There are not records in the recordset")
    End If
    %>

    Cheers
    Ken


    "Ray Medina" <compuex@bellsouth.net> wrote in message
    news:OVrMygH4DHA.1428@TK2MSFTNGP12.phx.gbl...
    : Ray...thanks for your quick response...but still does not work.
    :
    : When I see my page, I get a " in the dropdown and none of my data is
    : populating the dropdown. That is the only error I am getting.
    :
    : Is there any other way to accomplish this...?
    :
    :
    :
    :
    : "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
    : news:OTIfRbH4DHA.4084@TK2MSFTNGP11.phx.gbl...
    : > What isn't working right? Aside from the normal "how do I make my ASP
    : pages
    : > more efficient" things, I don't see anything explicitely wrong. ARe you
    : > getting an error? Are you getting something unexpected? If so, what?
    : What
    : > do you expect instead? What is appearing as extra? Oh, I see, you
    think
    : > there's an extra ".
    : >
    : > This line:
    : > <option
    : >
    :
    value="<%=CmdPopulateOS("OS_Version")%>"><%=CmdPop ulateOS("OS_Version")%></o
    : > ption>
    : >
    : > should show up like this in a view-source:
    : >
    : > <option value="The value">The Option</option>
    : >
    : > That's fine. Do your values have " in them, by chance?
    : >
    : >
    : > <option
    : >
    :
    value="<%=SafeOut(CmdPopulateOS("OS_Version"))%>"> <%=SafeOut(CmdPopulateOS("
    : > OS_Version"))%></option>
    : >
    : >
    : > <%
    : >
    : > Function SafeOut(theString)
    : > SafeOut = Replace(theString, """", "&quot;")
    : > End Function
    : >
    : > %>
    : >
    : > Ray at work
    : >
    : >
    : >
    : > "Ray Medina" <compuex@bellsouth.net> wrote in message
    : > news:uZtTOTH4DHA.416@TK2MSFTNGP10.phx.gbl...
    : > > I developing this web app for our department, I am using FP2002, SQL
    : > > back-end. I have 3 tables in my database at the moment and which it
    : will
    : > > grow to about 10-15 tables in 4 months....Now..
    : > >
    : > > In my Webform that I need to create a new record for the "Server
    : Matrix",
    : > I
    : > > need to pull some info from my tbl_OS and tbl_Staff and I can't seem
    to
    : be
    : > > able to accomplish this. I have seen many many samples but they all
    lead
    : > to
    : > > the same problem. It looks like I have something extra in my
    code...Can
    : > > someone help me with this?? The command that is having the problem,
    ("so
    : I
    : > > think") is the <option></option>, there is (I think) an extra
    "........
    : > >
    : > >
    : > > <%
    : > > Dim DataConn
    : > > Dim CmdPopulateOS
    : > > Dim SQL
    : > > %>
    : > > <%
    : > > Set DataConn=Server.CreateObject("ADODB.Connection")
    : > > Set CmdPopulateOS=Server.CreateObject("ADODB.Recordset ")
    : > > %>
    : > > <%
    : > > DataConn.Open "Driver={SQL
    : > > SERVER};Server=SERVERNAME;UID=USER;pwd=password;Da tabase=SACKBA;"
    : > >
    : > > SQL = "SELECT * FROM tbl_OS"
    : > > CmdPopulateOS.Open SQL, DataConn
    : > > %>
    : > >
    : > > <select size="1" name="OS_Version">
    : > > <%while not cmdpopulateOS.eof%>
    : > > <option
    : > >
    : >
    :
    value="<%=CmdPopulateOS("OS_Version")%>"><%=CmdPop ulateOS("OS_Version")%></o
    : > > ption>
    : > > <%
    : > > CmdPopulateOS.MoveNext
    : > > Wend
    : > > %>
    : > > <%
    : > > CmdPopulateOS.Close
    : > > Set CmdPopulateOS=Nothing
    : > > DataConn.Close
    : > > Set DataConn=Nothing
    : > > %>
    : > > </select>
    : > >
    : > >
    : >
    : >
    :
    :


    Ken Schaefer Guest

  6. #5

    Default Re: Dynamic Drop Down (SQL and ASp)

    This problem is closed now...
    "Ray Medina" <compuex@bellsouth.net> wrote in message
    news:OVrMygH4DHA.1428@TK2MSFTNGP12.phx.gbl...
    > Ray...thanks for your quick response...but still does not work.
    >
    > When I see my page, I get a " in the dropdown and none of my data is
    > populating the dropdown. That is the only error I am getting.
    >
    > Is there any other way to accomplish this...?
    >
    >
    >
    >
    > "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
    > news:OTIfRbH4DHA.4084@TK2MSFTNGP11.phx.gbl...
    > > What isn't working right? Aside from the normal "how do I make my ASP
    > pages
    > > more efficient" things, I don't see anything explicitely wrong. ARe you
    > > getting an error? Are you getting something unexpected? If so, what?
    > What
    > > do you expect instead? What is appearing as extra? Oh, I see, you
    think
    > > there's an extra ".
    > >
    > > This line:
    > > <option
    > >
    >
    value="<%=CmdPopulateOS("OS_Version")%>"><%=CmdPop ulateOS("OS_Version")%></o
    > > ption>
    > >
    > > should show up like this in a view-source:
    > >
    > > <option value="The value">The Option</option>
    > >
    > > That's fine. Do your values have " in them, by chance?
    > >
    > >
    > > <option
    > >
    >
    value="<%=SafeOut(CmdPopulateOS("OS_Version"))%>"> <%=SafeOut(CmdPopulateOS("
    > > OS_Version"))%></option>
    > >
    > >
    > > <%
    > >
    > > Function SafeOut(theString)
    > > SafeOut = Replace(theString, """", "&quot;")
    > > End Function
    > >
    > > %>
    > >
    > > Ray at work
    > >
    > >
    > >
    > > "Ray Medina" <compuex@bellsouth.net> wrote in message
    > > news:uZtTOTH4DHA.416@TK2MSFTNGP10.phx.gbl...
    > > > I developing this web app for our department, I am using FP2002, SQL
    > > > back-end. I have 3 tables in my database at the moment and which it
    > will
    > > > grow to about 10-15 tables in 4 months....Now..
    > > >
    > > > In my Webform that I need to create a new record for the "Server
    > Matrix",
    > > I
    > > > need to pull some info from my tbl_OS and tbl_Staff and I can't seem
    to
    > be
    > > > able to accomplish this. I have seen many many samples but they all
    lead
    > > to
    > > > the same problem. It looks like I have something extra in my
    code...Can
    > > > someone help me with this?? The command that is having the problem,
    ("so
    > I
    > > > think") is the <option></option>, there is (I think) an extra
    "........
    > > >
    > > >
    > > > <%
    > > > Dim DataConn
    > > > Dim CmdPopulateOS
    > > > Dim SQL
    > > > %>
    > > > <%
    > > > Set DataConn=Server.CreateObject("ADODB.Connection")
    > > > Set CmdPopulateOS=Server.CreateObject("ADODB.Recordset ")
    > > > %>
    > > > <%
    > > > DataConn.Open "Driver={SQL
    > > > SERVER};Server=SERVERNAME;UID=USER;pwd=password;Da tabase=SACKBA;"
    > > >
    > > > SQL = "SELECT * FROM tbl_OS"
    > > > CmdPopulateOS.Open SQL, DataConn
    > > > %>
    > > >
    > > > <select size="1" name="OS_Version">
    > > > <%while not cmdpopulateOS.eof%>
    > > > <option
    > > >
    > >
    >
    value="<%=CmdPopulateOS("OS_Version")%>"><%=CmdPop ulateOS("OS_Version")%></o
    > > > ption>
    > > > <%
    > > > CmdPopulateOS.MoveNext
    > > > Wend
    > > > %>
    > > > <%
    > > > CmdPopulateOS.Close
    > > > Set CmdPopulateOS=Nothing
    > > > DataConn.Close
    > > > Set DataConn=Nothing
    > > > %>
    > > > </select>
    > > >
    > > >
    > >
    > >
    >
    >

    Ray Medina Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139