Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > How to add a button to Modify, delete or add a new record to this code

Reply
Thread Tools

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

 
 
karenmiddleol@yahoo.com
Guest
Posts: n/a
 
      10-01-2005
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
%>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
You cannot add or change a record because a related record is required in table 'lok" André ASP .Net 0 06-25-2006 01:30 PM
You cannot add or change a record because a related record is required in table 'lok" André ASP .Net Web Controls 0 06-25-2006 01:30 PM
How to insert a new record in detailsview when there are no record Frits van Soldt ASP .Net Web Controls 2 11-17-2005 09:18 AM
How to add a button to Modify, delete or add a new record to this code karenmiddleol@yahoo.com ASP General 2 10-04-2005 11:55 AM



Advertisments