How to add a button to Modify, delete or add a new record to this code

Discussion in 'ASP General' started by karenmiddleol@yahoo.com, Oct 1, 2005.

  1. Guest

    The following code works fine I can connect to a SQL database and list
    all the records in the Orders table onto a web page.

    Now our users want me to modify it so that each row displayed as a
    button or a hyperlink for Modify, Delete and also they want the data
    displayed not in a HTML table as I am doing but like in a form they
    want the ability to change the data in the fields. So when the user
    clicks on the modify button for a row then they want to capture what is
    on the screen and update the database table.
    Similarly, if they click the delete button or hyperlink on a row they
    want it deleted.

    Also, at the end of displaying all records in the table they want a
    button or link to insert a new record.

    Can you kindly let me know the changes to this code to accomplish this.


    Thanks
    Karen

    <html>
    <title>test</title>
    <body>
    <%
    dim cn, rs, sql
    dbname = "NorthWind"
    Cn = "provider=SQLOLEDB;network=DBMSSOCN;"
    Cn = Cn & "uid=sa;pwd=sa;server="
    Cn = cn & "testserver;database=" & "NorthWind"


    Set rs = Server.CreateObject("ADODB.Recordset")
    sql = "select * from Orders"
    rs.Open sql, cn
    %>

    <table BORDER="1" align="center" width="640">
    <tr>
    <td>OrderID</td>
    <td>CustomerId</td>
    <td>ShipName</td>
    <td>ShipCity</td>
    <td>ShipCountry</td>
    </tr>
    <%
    ' Move to the first record
    rs.movefirst
    ' Start a loop that will end with the last record
    do while not rs.eof
    %>
    <tr>
    <td>
    <%= rs("OrderId") %>
    </td>
    <td>
    <%= rs("CustomerId") %>
    </td>
    <td>
    <%= rs("ShipName") %>
    </td>
    <td>
    <%= rs("ShipCity") %>
    </td>
    <td>
    <%= rs("ShipCountry") %>
    </td>
    </tr>
    <%
    rs.movenext
    loop %>
    </table>
    </body>
    </html>
    <%
    rs.close
    set rs=nothing
    %>
     
    , Oct 1, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. HeroOfSpielburg
    Replies:
    1
    Views:
    401
    Alf P. Steinbach
    Aug 6, 2003
  2. Jef Driesen
    Replies:
    1
    Views:
    514
    Gernot Frisch
    Jan 19, 2005
  3. André
    Replies:
    0
    Views:
    3,761
    André
    Jun 25, 2006
  4. X X
    Replies:
    4
    Views:
    361
    red floyd
    Jul 19, 2010
  5. Replies:
    2
    Views:
    240
Loading...

Share This Page