Gimme your:
First Name:
Last Name:
Age:
>
列表 D: buildSQLInsert函數的最終版。
<%
function buildSQLInsert( targetTable, omitFIElds)
iStr = "insert into " & targetTable & " "
vStr = "values ("
nStr = "("
在表單集合中循環,並建立起SQL語句的組成部分
for each x in request.form
fIEldName = uCase(x)
判斷字段是否被省略?
if inStr(uCase(omitFIElds),x) = 0 then
fieldData = replace(request.form(fIEldName), _
"", "")
如果沒有數據,就插入 NULL
if trim(fIEldData) = "" then
fIEldData = "NULL"
vStr = vStr & fIEldData & ", "
nStr = nStr & fIEldName & ", "
else
typeDelimPos = inStr(fIEldName, "_")
if typeDelimPos = 0 then
是文本字段
建立字段名列表
nStr = nStr & fIEldName & ", "