<%
Response.Expires=0
Set Conn=Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath("mdb/demo.mdb") & ";Mode=ReadWrite|Share Deny None;Persist Security Info=False"
%>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>
<!--
.p1 {	FONT-SIZE: 9pt}
.l1 {	BORDER: #000080 2px solid}
-->
</style>
</HEAD>
<BODY>
<TABLE cellPadding=0 cellSpacing=10 class=l1>
<TR><TD>
<TABLE class=p1>
<%
dim sql
dim i
dim outstr

  If Request.ServerVariables("Request_Method")="GET" then
    sql="select * from admin"
    Set RS=Server.CreateObject("ADODB.RecordSet")
    RS.Open sql,conn,3,2
    outstr="<FORM name=forma action=access.asp method=post>"
    outstr=outstr & "<TR><TD align=middle>帐号</TD><TD align=middle>密码</TD></TR>"
    for i=1 to 3
      if i<=RS.RecordCount then
        outstr=outstr & "<TR><TD><INPUT class=p1 name=t1" & i & " size=20 value=" & chr(34) & RS("帐号") & chr(34) & "></TD><TD><INPUT class=p1 name=t2" & i & " size=20 value=" & chr(34) & RS("密码") & chr(34) & "></TD></TR>"
        RS.MoveNext
      else
        outstr=outstr & "<TR><TD><INPUT class=p1 name=t1" & i & " size=20></TD><TD><INPUT class=p1 name=t2" & i & " size=20></TD></TR>"
      end if 
    next
    Response.Write(outstr)
%>
<TR><TD align=middle colSpan=2><A href="javascript:document.forma.submit();">修改数据</A></TD></TR>
<%
    Conn.Close
    Set Conn=Nothing
  else
    Set RS=Conn.Execute("delete * from admin")
    for i=1 to 3
      sql="insert into admin (帐号,密码) values('" & Request.Form("t1" & i) & "','" & Request.Form("t2" & i) & "')"
      Set RS=Conn.Execute(sql)
    next
%>
<TR><TD align=middle class=p5>修改操作成功<BR><BR><A href="access.asp">显示数据</A></TD></TR>
<%    
    Conn.Close
    Set Conn=Nothing
  end if
%>
</TABLE>
</TD></TR></TABLE>
</BODY>
</HTML>