ASP Tutorials

Edit Records

display_admin.asp

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!-- #include file = "data_source.inc" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Display my Quotes</title>
<style type="text/css">
<!--
body {background: #fff;}
#container {margin: auto; width:700px;}
.quote {background: #F0F0E1; padding: 1em; font: 19px Georgia, "Times New Roman", Times, serif;}
.author {text-align: right; margin-bottom: 2em; font: 10px Verdana, Geneva, sans-serif;}

#edit_container {padding-bottom: 1em; text-align: right;}
#edit_container a {text-decoration: none; color:#F00; padding-left: 20px;}
#edit_container a:hover {color:#f90;}

-->
</style>
</head>

<body>
<div id="container">
<%
Dim my_connection, my_query, my_recordset

my_query = "SELECT * FROM my_quotes"
set my_connection = server.createObject("ADODB.Connection")
set my_recordset = server.createObject("ADODB.Recordset")

my_connection.open(my_database_source)
my_recordset.open my_query, my_connection
%>

<%
do while not my_recordset.eof

response.write "<div id='edit_container'>"
response.write "<a href=edit.asp?quote_id=" & my_recordset("quote_id") & ">edit</a>" & " "

response.write "<a onclick=""return confirm('Are you sure?')"" href=delete.asp?quote_id=" & my_recordset("quote_id") & ">delete</a>"
response.write "</div>"

response.write "<div class='quote'>" & my_recordset("quote") & "</div>" & _
"<div class='author'>" & my_recordset("first_name") & _
my_recordset("last_name") & "</div>"

my_recordset.moveNext
loop
%>

<%
my_recordset.close
set my_recordset=nothing

my_connection.close
set my_connection=nothing
%>
</div>
</body>
</html>

ASP Tutorials
Other Tutorials