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

K

karenmiddleol

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
%>
 
H

Helen

Hi Karen,

I take it from your code you are using ASP not ASP.NET?

Let me know and I will try to come up with some suggestions.
 
K

karenmiddleol

Hi Helen

I am working on ASP.

If I was using ASP.Net I would have used one of the number of options.

Please help if you can for classic ASP.

Thanks
Karen
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top