Help! Dependent Lists with SQL Server (with code/db setup) assistance needed!

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

  1. #1

    Default Help! Dependent Lists with SQL Server (with code/db setup) assistance needed!

    Hey folks, i'm _trying_ to get a dependent list box example working
    from this example/tutorial found at
    [url]http://www.asp101.com/resources/DependentLists.asp[/url]. The tutorial
    originally had an access DB, but i've since changed that to sql server
    (maybe thats the problem!?)

    Well, i've run into plenty of problems doing this (ahh the joys of
    learning eh!), but decided to keep with it. The error i am getting now
    is as follows:

    Error Type:
    (0x80020009)
    Exception occurred.
    /traffic/TMP4yk8jopikk.asp, line 56

    If anyone can point me in the right direction, well... you will have
    made this guys weekend much less worry free! thanks people!

    :::::INFO::::::

    :::::MY DATABASE:::::

    CATEGORY

    Name Properties Desc
    |-------------------------------------------
    |category_id | Int Autonumber
    |-------------------------------------------
    |Category | varchar Name of the Category
    |-------------------------------------------


    SUBCATEGORY

    Name Properties Desc
    |------------------------------------------------------
    |Subcategory_id | int Autonumber
    |------------------------------------------------------
    |Subcategory | varchar Name of the Subcategory
    |------------------------------------------------
    |Subcategory_of | varchar This category that this is a
    subcategory of.
    |------------------------------------------------------

    :::::MY PAGE:::::


    <%@LANGUAGE="VBSCRIPT"%>
    <!--#include file="../Connections/trafficbranch.asp" -->
    <%
    Dim rs
    Dim rs_numRows

    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.ActiveConnection = MM_trafficbranch_STRING
    rs.Source = "SELECT * FROM dbo.subcategory"
    rs.CursorType = 0
    rs.CursorLocation = 2
    rs.LockType = 1
    rs.Open()

    rs_numRows = 0
    %>
    <%Response.Buffer = true%>
    <HTML>
    <HEAD>



    <script language = "JavaScript">
    function subcat()
    cat = document.subad.catagory[document.subad.catagory.selectedIndex].value;
    url = "submitad.asp?cat="
    url = url + cat;
    window.location.href< = url;
    function sublist(inform, selecteditem)
    inform.subcatagory.length = 0
    <%
    count= 0
    y=0
    do while not rs.eof
    %>
    inform.subcatagory.options[inform.subcatagory.length]=option <%=
    trim(count)%>
    <%
    count = count + 1
    y = y + 1
    rs.movenext
    loop
    %>
    </script>
    <title></title>
    </HEAD>
    <BODY onLoad = "sublist(document.subad,document.subad.catagor y[document.subad.catagory.selectedIndex].value)">

    <form name = subad action = "thankyouad.asp" >
    <Table>
    <tr>
    <td height="24">First Name</td>
    <td>Last Name</td>
    </tr>x = <%= trim(y) %>
    subcat = new Array();
    subcatagorys = "<%= trim(rs("subcatagory"))%>"
    subcatagoryof = "<%= trim(rs("subcat_of"))%>"
    subcatagoryid = "<%= trim(rs("subcatagory_id"))%>"
    subcat[x,0] = subcatagorys;
    subcat[x,1] = subcatagoryof;
    subcat[x,2] = subcatagoryid;
    if (subcat[x,1] == selecteditem)
    {
    var option<%= trim(count) %> = new Option(subcat[x,0], subcat[x,2])

    <tr>
    <td ><Input NAME="NameFirst" size ="30" value=<%=fn%> ></td>
    <td><Input NAME="NameLast" size ="40" value=<%=ln%>></td>
    </tr>
    <tr>
    <td>Work Phone</td>
    <td>Home Phone</td>
    </tr>
    <tr>
    <td><Input NAME="workphone" MaxLength="15" value="<%=wp%>" ></td>
    <td><Input NAME="homephone" MaxLength="15" value="<%=hp%>" ></td>
    </tr>
    <tr>
    <td>Email</td>
    </tr>
    <tr>
    <td><Input NAME="email" MaxLength="50" value=<%=em%>></td>
    </tr>
    </table>
    <table>
    <tr>
    <td>Headline</td>
    </tr>
    <tr>
    <td><Input Name = "headline" MaxLength = "100" value="" size=50></td>
    </tr>
    <tr>
    <td>Description</td>
    </tr>
    <tr>
    <td><textarea name = "description" rows = 5 cols = 50></textarea></td>
    </tr>
    <%
    cat = Request.QueryString("cat")
    sqlstring = "SELECT * from classfd_Catagory"
    set rs = conn.execute (sqlstring)
    %>
    <tr>
    <td>Catagory</td>
    </tr>
    <tr>
    <td><SELECT id=catagory name=catagory onChange = "sublist(this.form,
    document.subad.catagory[document.subad.catagory.selectedIndex].value)">
    <OPTION selected value=""></OPTION>
    <%
    do until rs.eof
    %>
    <OPTION value="<%= rs("catagory_id")%>"><% = rs("catagory")%></OPTION>
    <%
    rs.movenext
    loop
    set rs = nothing
    %>
    </SELECT></td>
    </tr>
    <tr>
    <td><SELECT id = "subcatagory" name="subcatagory">
    <Option selected value="none">-------------------------</option>
    </SELECT>
    </td>
    </tr>
    <tr>
    <td>Price</td>
    <tr>
    <tr>
    <td><INPUT type="text" id=price name=price></td>
    </tr>
    <td><Input type=submit value = "Submit" id=submit1 name=submit1 ></td>
    </tr>
    </table >
    </form>
    </BODY>
    </HTML>
    <%
    rs.Close()
    Set rs = Nothing
    %>
    nathan Guest

  2. Similar Questions and Discussions

    1. Help with dependent drop down lists and datagrids
      I'm trying to create two drop down boxes and a data grid wherethe content of the second drop down list depends on the intemselected in the first drop...
    2. Dependent Drop Down Lists
      I want to have a form with several standard test boxes. I also want two drop down lists. The first list has options, based on the option that is...
    3. Assistance needed
      i'm just trying to ge the effect of a flickering screen with interlaced lines. i have seen this done but can't remeber where any assistance will be...
    4. Assistance Needed...
      COMPLETE NOVICE - SORRY... Greetings. I have a big problem with a flash file, I need to change the text displayed on mouse over / hit, But...
    5. Help requested - need setup assistance with D-Link DP-300 Print Server
      Hi John, I guess this is a bit late, but I am just dealing with a D-link DP-300+ print server at the moment. Unfortuntely, I am doing everything...
  3. #2

    Default Re: Help! Dependent Lists with SQL Server (with code/db setup) assistance needed!

    Too much?

    ************************************************** ********************
    Sent via Fuzzy Software @ [url]http://www.fuzzysoftware.com/[/url]
    Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
    n4th4n@hushmail.com Guest

  4. #3

    Default Re: Help! Dependent Lists with SQL Server (with code/db setup) assistance needed!

    Too much what? Impatience? Yes.

    Ray at work

    "nathan f" <n4th4n@hushmail.com> wrote in message
    news:O1fHe5EsDHA.2444@TK2MSFTNGP12.phx.gbl...
    > Too much?
    >
    > ************************************************** ********************
    > Sent via Fuzzy Software @ [url]http://www.fuzzysoftware.com/[/url]
    > Comprehensive, categorised, searchable collection of links to ASP &
    ASP.NET resources...


    Ray at Guest

  5. #4

    Default Re: Help! Dependent Lists with SQL Server (with code/db setup) assistance needed!

    Too much what? Irrelevant HTML? Yes.

    Ray at work

    "nathan f" <n4th4n@hushmail.com> wrote in message
    news:O1fHe5EsDHA.2444@TK2MSFTNGP12.phx.gbl...
    > Too much?
    >
    > ************************************************** ********************
    > Sent via Fuzzy Software @ [url]http://www.fuzzysoftware.com/[/url]
    > Comprehensive, categorised, searchable collection of links to ASP &
    ASP.NET resources...


    Ray at Guest

  6. #5

    Default Re: Help! Dependent Lists with SQL Server (with code/db setup) assistance needed!

    Too much what? Indication of what line is number 56? No.

    Ray at work

    "nathan f" <n4th4n@hushmail.com> wrote in message
    news:O1fHe5EsDHA.2444@TK2MSFTNGP12.phx.gbl...
    > Too much?
    >
    > ************************************************** ********************
    > Sent via Fuzzy Software @ [url]http://www.fuzzysoftware.com/[/url]
    > Comprehensive, categorised, searchable collection of links to ASP &
    ASP.NET resources...


    Ray at Guest

  7. #6

    Default Re: Help! Dependent Lists with SQL Server (with code/db setup) assistance needed!

    Hey! Thanks for your trolling, I fixed it, you can go back under your bridge now. Thanks.

    ************************************************** ********************
    Sent via Fuzzy Software @ [url]http://www.fuzzysoftware.com/[/url]
    Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
    n4th4n@hushmail.com 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