<%
iStr = "insert into uData "
vStr = "values ("
nStr = "("
' 在表單集合中循環,並建立起SQL語句的組成部分
for each x in request.form
' 建立字段名列表
nStr = nStr & x & ", "
' 建立字段值列表
if uCase(x) = "AGE" then
vStr = vStr & request.form(x) & ", "
else
vStr = vStr & "'" & request.form(x) & "', "
end if
next
' 把結尾的", " 從我們建立的字符串中去掉
vStr = left(vStr, len(vStr) - 2) & ")"
nStr = left(nStr, len(nStr) - 2) & ") "
' 把SQL語句組裝起來
iStr = iStr & nStr & vStr
if trim(request("fName")) >> "" then
response.write( iStr & ">BR>