通过本文主要向大家介绍了sql表单,sql删除表单,sql查询表单,html怎样提交表单,html post提交表单等相关知识,希望本文的分享对您有所帮助
正在看的db2教程是:用表单来提交sql(转)3。 列表 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 & ", "
vStr = vStr &
else
字段是其它类型
fieldType = left(fieldName, typeDelimPos - 1)
fieldName = mid(fieldName, typeDelimPos + 1)
把字段名加入名称列表
nStr = nStr & fieldName & ", "
把字段类型变成大写以确保匹配
select case uCase(fieldType)
case "NUM"
vStr = vStr & fieldData & ", "
把不明类型按文本型处理
case else
vStr = vStr & "" & fieldData & ", "
&nb
<%
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 & ", "
vStr = vStr &
[1] [2] [3] [4] [5] 下一页
正在看的db2教程是:用表单来提交sql(转)3。"" & fieldData & ", "else
字段是其它类型
fieldType = left(fieldName, typeDelimPos - 1)
fieldName = mid(fieldName, typeDelimPos + 1)
把字段名加入名称列表
nStr = nStr & fieldName & ", "
把字段类型变成大写以确保匹配
select case uCase(fieldType)
case "NUM"
vStr = vStr & fieldData & ", "
把不明类型按文本型处理
case else
vStr = vStr & "" & fieldData & ", "
&nb