用表单来提交sql
来源:网络 责任编辑:栏目编辑 发表时间:2013-07-01 10:20 点击:次
列表 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
是文本字段
<%
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
是文本字段
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>