Edit form with dropdownlist

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • natalie84
    New Member
    • Feb 2010
    • 1

    Edit form with dropdownlist

    Here it goes.... I am using ASP. language: VB

    I have 2 database as follows....
    Database1: User_Details
    User_ID | User_Name
    ST-David | David John
    PUP-Peter | Peter Soh
    ST-Kelvin | Kelvin Tan

    Database2: User_Form
    Data| Created_BY
    A | ST-DJ
    B | PUP-PS

    I have 2 dropdownlist as follows....
    First dropdownlist
    --------------------------
    staff
    pupils

    Second dropdownlist
    ------------------------------
    Will display the User_Name in User_Details database.

    I need to create add, edit and delete. I already finish with the add and delete. I have problem with the edit. Do help me solve.

    As mentioned, I already create the edit form. I have the trouble in displaying both the dropdownlist. I want the system to check the database (CreatedBy) and if the 'createdby' starts with 'ST', the word 'staff' will be selected for the firstdropdownli st and if 'createdby' is 'ST-DJ', his full name will be selected in the second dropdownlist.

    I know I have to make the system check the user_details and so on.. But how to go about doing it?
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    Let's look at one question at a time. First, the "edit". There are two ways to do an edit, if you are very familiar with SQL you would probably make an "update" statement that you can send tot he db, but I think it is easier to use a recordset object, and then call the update() method of the recordset. Are you using a recordet now to pull up the data? If so, you have something that looks like this:
    Code:
    set objRS = server.createobject("adodb.recordset")
    objRS.open queryString, objConn, 2, 3
    to edit the recordset, simply navigate to the row you want to modify
    Code:
    objRS.moveNext
    make the changes, then call "update"
    Code:
    objRS("UserName")="Jim Bob"
    objRS.update()
    Let me know if this makes sense, and then we will move on.

    Jared

    Comment

    Working...