这种方法很方便但可能会不够灵活
<%
if request("Submit1")="提交" then
Set rs1=server.createobject("adodb.recordset")
sql1="select * from tb_user"
rs1.open sql1,conn,1,3
rs1.addnew
for i=0 to rs1.fields.count-1
if i<>0 then
rs1(rs1.fields(i).name)=request("txt"&i)
end if
next
rs1.update
response.write("<script language=javascript>alert('提交成功')</script>")
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>根据数据表结构自动生成数据录入页面</title>
<style type="text/css">
<!--
.style1 {
font-size: 12pt;
color: #FFFFFF;
}
-->
</style>
</head>
<body>
<%
'查询所要用户的信息
Set rs1=server.createobject("adodb.recordset")
sql1="select * from tb_user"
rs1.open sql1,conn,1,3
%>
<form name="form1" method="post" action="">
<table width="40%" border="1" align="center" cellpadding="0" cellspacing="0">
<tr bgcolor="#FF9933">
<td height="28" colspan="2"><div align="center" class="style1">用户资料</div></td>
</tr>
<%
for i=0 to rs1.fields.count-1
if i<>0 then
%>
<tr>
<td width="29%"> <%=rs1.fields(i).name%> </td>
<td width="71%"><input type="text" name="Txt<%=i%>"></td>
</tr>
<%
end if
next
%>
<tr align="center">
<td colspan="2"><input name="Submit1" type="submit" id="Submit1" value="提交">
<input type="reset" name="Submit2" value="重置"></td>
</tr>
</table>
</form>
</body>
</html>