programming-examples/asp/Sessions_SQL/Display Table, Edit Record, Update Record.asp
2019-11-18 14:25:58 +01:00

49 lines
1.1 KiB
Plaintext

<%
Response.Buffer=True
Response.ExpiresAbsolute = Now() - 1
Response.AddHeader "Cache-Control", "private"
%>
<html><head>
<title>authorshow.asp</title>
<meta http-equiv="pragma" content="no-cache">
</head><body bgcolor="#FFFFFF">
<%
myDSN="DSN=Student;uid=student;pwd=magic"
mySQL="select * from authors where AU_ID<100 order by author"
IDfield="AU_ID"
scriptresponder="authoredit.asp"
Set conntemp=Server.CreateObject("adodb.connection")
conntemp.open myDSN
Set rstemp=conntemp.execute(mySQL)
howmanyfields=rstemp.fields.count -1
%>
<table border="1">
<tr>
<td valign="top">---</td>
<% 'Put Headings On The Table of Field Names
For i=0 To howmanyfields %>
<td><b><%=rstemp(i).name %></b></td>
<% Next %>
</tr>
<% ' Now lets grab all the records
Do While Not rstemp.eof %>
<tr><td valign="top">
<%my_link=scriptresponder & "?which=" & rstemp(idfield)%>
<a HREF="<%=my_link%>">Edit</a></td>
<% For i = 0 To howmanyfields%>
<td valign="top"><%=rstemp(i)%></td>
<% Next %>
</tr>
<%
rstemp.movenext
Loop
rstemp.close
Set rstemp=Nothing
conntemp.close
Set conntemp=Nothing
%>
</table></body></html>