+ Reply to Thread
Page 1 of 3
1 2 3 LastLast
Results 1 to 5 of 12

Thread: populate dropdown from sql

  1. #1
    dovanchien1989
    Guest

    populate dropdown from sql

    Hello forum!,

    I'm new to ASP/forum and have to modify the code below. When the app is ran you get a list of checkboxes to choose from which passes values to crystal reports. All I need to do is change those checkboxs to dropdowns. Can someone give me some assistance here??








    Code:

    <%@ Language=VBScript %>
    <% Option Explicit %>
    <%
    Dim dFrom, dTo
    Dim iIncidentID
    Dim aTypeID, aStatusID,aPayGradeID

    aTypeID = Split(Request.Form("chkTypeID"), ",")
    aStatusID = Split(Request.Form("chkStatusID"), ",")
    aPayGradeID = Split(Request.Form("chkPayGradeID"), ",")

    iIncidentID = 0

    %>


    Test Report




    " & vbCrLf

    If iCat = CAT_STATUS Or iCat = CAT_TYPE Then _
    sbPrintChoices aChild(CLD_ID, i) , iCat, iPad 10, aID

    Next

    End If
    End Sub
    %>
    Sorry If this is really long. I believe the problem lies within the sbprintchoices, but not 0 sure.



    Any help is greatly appreicated!

    Thanks,

    d
    More Information:
    1. PHP - problem populating dropdown menu Hi!! I am trying to populate my dropdown menu by getting the values from the database
    2. I've created a dynamic drop down menu that populates itself with data from a MySQL table
    3. 2 posts - 1 author - Last post: Aug 1, 2008I have a unique situation in that I want to fill a drop downlist with the last part of my sql query with the last 2 values
    4. yes, using Anonymous Person's example from above, you can add another attribute to the DropDownList called "DataValueField"
    5. DataListCommandEventArgs e) { DataList DataList1 = (DataList)sender; sql = "SELECT ID, description, code FROM offence"; ds = new DataSet(); da
    6. Many times during the development of a form it may be necessary to dynamically populate a drop down control based on a selected value
    7. I need to populate 10 dropdown lists with the same SQL query
    8. 4 posts - 2 authors - Last post: Nov 21, 2007umbraco Forum » Extending umbraco » Extending umbraco » Populating drop down data type from a custom sql table
    9. First i bound the dropdownlist with simple datasource (a public string array)
    10. Visit Dev Articles to discuss Drop Down Menu - populated from a mysql database

    More:


  2. #2
    hoang phuong
    Guest

    change this into





    then add the following before your loop



    you may also add your checker and select:

    If CInt(sID) = aChild(CLD_ID, i) Then Response.Write " checked"

    here





    hope this will work out, check if I haven't made mistakes when typing <%%>
    More Information:
    1. Is there an easy way to populate a drop-down list from a SQL table in Zend framework/PHP? Thanks, GTG
    2. I have a form with a dropdown list of Project#'s on SQL and would like the user to be
    3. The third way for binding a DropDownList to a LINQ to SQL table is through the use of custom light-weight business objects and reflection
    4. one is the drop down menu which gets the values from db and gets populated second one is the one which replaces the sql and shows the results of select statement
    5. Here is the DropDownList code is asp and below the code in my codebehind: <asp:DropDownList ID="DropDownList1" runat="server" Width="175px"
    6. Right now it just populates with the first value of the query
    7. net" (You might like to read more articles similar to populating dropdown list in vb
    8. I am actually still having a problem with the DropDown list
    9. hi,I want to populate a drop down list from SQL server database and then if one of the item in the list was selected,it will populate a datagrid based

  3. #3
    Simpatyashka
    Guest

    Thanks for the response..

    When I inserted the code I got a bunch of dropdowns, but instead of being grouped together each option had its own dropdown, and in the dropdown was the 'chk..' not the actual choice.
    More Information:
    1. Outlook Forms VBSCRIPT code to populate dropdown list from SQL, how?
    2. 4 posts - 4 authors - Last post: May 14, 2009I have a typical ASP page with a dropdownlist web form control
    3. Now the problem, If i select in the dropdown menu "Madagascar", i will se the related page of madagascar
    4. The drop down used for the initial selection is populated from a SQL 2005 table containing two columns of data (key field and
    5. I need to populate an InfoPath drop-down list with information on an external SQL database
    6. I am trying to populated a dropdownlist box with states when their corresponding country is selected in another dropdownlist box using a SQL server 2005 database
    7. will this work in a loop? i have sql datareader with a while loop
    8. Mysql php select use dropdown menu populate populating dynamic projects
    9. 4 posts - 2 authors - Last post: May 22, 2006I'm trying to populate a dropdown list from SQL Server but it's not being populated
    10. Here i will try to show how we can bind sql server data with a Dropdown List as well as after selection populate other Dropdown List

  4. #4
    coolrahul39
    Guest

    well, just tell me what you got there, I mean did you get it to work?
    More Information:
    1. Hello, I am trying to find some help on displaying UNIQUE values in a dropdown list populated from a SQL server database
    2. How do i dynamically populate a Drop-Down box in excel with sql
    3. Visit Tutorialized to discuss Aspx in Notepad - populate a dropdown with SQL DB & query
    4. The edit form dropdownlists need to be primarily set to the existing values in
    5. If IE will re-populate a div tag no problem then how about doing that

  5. #5
    tg138
    Guest

    no it didnt work. none of the dropdowns have options in them, just the word 'chkTypeID' . Maybe I did something wrong??




    Code:


    If IsArray(aChild) Then
    For i = LBound(aChild, 2) To UBound(aChild, 2) %>

  6. " & vbCrLf

    If iCat = CAT_STATUS Or iCat = CAT_TYPE Then _
    sbPrintChoices aChild(CLD_ID, i), iCat, iPad 10, aID

    End If
    End Sub
    %>
    More Information:
    1. I'm a SQL DBA, not a programmer and know nothing about xml
    2. Hi, i have a drop box in a form that is populated using a SQL query
    3. With this query we can populate the first drop down list
    4. Displaying search result for: populate drop down from a SQL table in jsp
    5. Author:yanomamo, Question:'Populating dropdownlist w/ SQL Reporting Services Reports', Category:ADO, Length:437 bytes, No Comments, it's a Difficult issues
    6. So what I would like to se in the dropdownlist is the p

    Similar Threads

    1. Best way to populate a forum?
      I'm going to be opening a couple of forums soon to do with domains and hosting, just wondered what sort of budget you'd need to popuate your own...
    2. How to populate an article directory?
      I just bought a PR3 domain and I've put an articleMS system on it and I'd love to hear some feedback on how to get some articles on it, aside from...
    3. Change dropdown list based on selection of a different dropdown list.
      I have a problem with dropdown list of countries. When one is selected, I need the list of states or provences from that selected country to populate...
    4. suckerfish dropdown problem - dropdown not lining up in IE
      I'm hoping someone can help me with a strange css problem I'm having. I've implemented the sons of suckerfish dropdowns for a menu, and it looks...
    5. pOPULATE COMBOBOX
      Hi all, i have already populate a list from my database using the following code Code:

    Tags for this Thread

    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
    Automatic Translations (Powered by Powered by Google):
    Afrikaans Albanian Arabic Belarusian Bulgarian Catalan Chinese Croatian Czech Danish Dutch English Estonian Filipino Finnish French Galician German Greek Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Taiwanese Thai Turkish Ukrainian Vietnamese Welsh Yiddish

    STATUS

    <%
    sbPrintChoices ROOT_ID, CAT_STATUS, 0, aStatusID
    %>


    STATUS2

    <%
    sbPrintChoices ROOT_ID, CAT_STATUS2, 0, aStatus2ID
    %>





    <%
    Sub sbPrintChoices(ByVal iParentID, ByVal iCat, ByVal iPad, ByRef aID)
    Dim aChild, i, sCat, sID
    Select Case iCat
    Case CAT_STATUS
    sCat = "Status"
    sSQL = "SELECT tbl_Status.sta_StatusID, tbl_Status.sta_Status, tbl_SubStatus.sst_Type, tbl_SubStatus.sst_Multiple, tbl_SubStatus.sst_Type " & _
    "FROM tbl_Status INNER JOIN tbl_SubStatus ON tbl_Status.sta_StatusID = tbl_SubStatus.sst_ChildID " & _
    "WHERE tbl_SubStatus.sst_ParentID = " & iParentID & " ORDER BY tbl_Status.sta_StatusID"

    Case CAT_PAYGRADE
    sCat = "PayGrade"
    sSQL = "SELECT pay_PayGradeID, pay_PayGrade, 0 AS theType FROM tbl_Paygrade ORDER BY pay_PayGradeID"


    End Select

    openRst sSQL, "", "", "", "", ""
    If Not oRst.EOF Then aChild = oRst.GetRows
    closeRst

    If IsArray(aChild) Then
    For i = LBound(aChild, 2) To UBound(aChild, 2) %>



    <% If aChild(CLD_TYPE, i) <> 2 Then %>



    <%
    If IsArray(aID) Then
    For Each sID In aID
    If CInt(sID) = aChild(CLD_ID, i) Then Response.Write " checked"
    Next
    End If
    Response.Write "/> " & aChild(CLD_NAME, i)
    Response.Write "
    " & vbCrLf
    Else
    Response.Write " " & aChild(CLD_NAME, i) & "
    " & vbCrLf
    End If
    Response.Write "


    <% If aChild(CLD_TYPE, i) <> 2 Then %>





    <% Next
    End If
    Response.Write "/> " & aChild(CLD_NAME, i)
    Response.Write "
    " & vbCrLf
    Else
    Response.Write " " & aChild(CLD_NAME, i) & "
    " & vbCrLf
    End If
    Response.Write "