<%
'從表單中提取值
fName = request.form("fName")
lName = request.form("lName")
age = request.form("age")
'建立SQL語句
iStr = "insert into uData (fName, lName, age) "
iStr = iStr & "values ("
iStr = iStr & "'" & fName & "', "
iStr = iStr & "'" & lName & "', "
iStr = iStr & age & ")"
if trim(fName <> "") then
response.write( iStr & "<BR>")
else
%>
<Html>
<body>
<form name=f method=post action="listing1.ASP">
Gimme your:<br>
First Name: <input type=text name="fName"><br>
Last Name: <input type=text name="lName"><br>
Age: <input type=text name="age"><br>
<input type="submit" value="Submit">
</form>
</body>
</Html>
<%
end if
%>
列表 B:使用 request.form 來輕松建立SQL字符串。
<%
iStr = "insert into uData "
vStr = "values ("
nStr = "("
' 在表單集合中循環,並建立起SQL語句的組成部分
for each x in request.form
' 建立字段名列表
&