The db2 tutorial I am watching is: use form to submit SQL (transfer) 3. List D: The final version of the buildSQLInsert function.
function buildSQLInsert( targetTable, omitFields)
iStr = "insert into " & targetTable & " "
vStr = "values ("
nStr = "("
Loop in the form collection and establish components of SQL statements
for each x in
fieldName = uCase(x)
Whether the judgment field is omitted?
if inStr(uCase(omitFields),x) = 0 then
fieldData = replace((fieldName), _
"", "")
If there is no data, insert NULL
if trim(fieldData) = "" then
fieldData = "NULL"
vStr = vStr & fieldData & ", "
nStr = nStr & fieldName & ", "
else
typeDelimPos = inStr(fieldName, "_")
if typeDelimPos = 0 then
Is a text field
Create a list of field names
nStr = nStr & fieldName & ", "
vStr = vStr &
else
Fields are other types
fieldType = left(fieldName, typeDelimPos - 1)
fieldName = mid(fieldName, typeDelimPos + 1)
Add the field name to the name list
nStr = nStr & fieldName & ", "
Turn field types into uppercase to ensure matching
select case uCase(fieldType)
case "NUM"
vStr = vStr & fieldData & ", "
Process unknown types as text types
case else
vStr = vStr & "" & fieldData & ", "
end select
end if
&
end if
next
Remove the ending ", " from the string we created
vStr = left(vStr, len(vStr) - 2) & ")"
nStr = left(nStr, len(nStr) - 2) & ") "
Integrate SQL statements
buildSQLInsert = iStr & nStr & vStr
end function
if trim(request("fName")&request("lname")&request("age")) "" then
( buildSQLInsert("") & "
( buildSQLInsert("NUM_AGE") & "
")
( buildSQLInsert("lname,fname") & "
")
( buildSQLInsert("mycheckbox,fname") &
=else
%>
end if
%>
List D: The final version of the buildSQLInsert function.
function buildSQLInsert( targetTable, omitFields)
iStr = "insert into " & targetTable & " "
vStr = "values ("
nStr = "("
Loop in the form collection and establish components of SQL statements
for each x in
fieldName = uCase(x)
Whether the judgment field is omitted?
if inStr(uCase(omitFields),x) = 0 then
fieldData = replace((fieldName), _
"", "")
If there is no data, insert NULL
if trim(fieldData) = "" then
fieldData = "NULL"
vStr = vStr & fieldData & ", "
else
typeDelimPos = inStr(fieldName, "_")
if typeDelimPos = 0 then
Is a text field
Create a list of field names
nStr = nStr & fieldName & ", "
vStr = vStr & "" & fieldData & ", "
else
Fields are other types
fieldType = left(fieldName, typeDelimPos - 1)
fieldName = mid(fieldName, typeDelimPos + 1)
Add the field name to the name list
nStr = nStr & fieldName & ", "
Turn field types into uppercase to ensure matching
select case uCase(fieldType)
&n
vStr = vStr & fieldData & ", "
Process unknown types as text types
case else
vStr = vStr & "" & fieldData & ", "
end select
end if
end if
end if
next
Remove the ending ", " from the string we created
vStr = left(vStr, len(vStr) - 2) & ")"
nStr = left(nStr, len(nStr) - 2) & ") "
Integrate SQL statements
buildSQLInsert = iStr & nStr & vStr
end function
if trim(request("fName")&request("lname")&request("age")) "" then
( buildSQLInsert("") & "
( buildSQLInsert("NUM_AGE") & "
")
( buildSQLInsert("lname,fname") & "
")
( buildSQLInsert("mycheckbox,fname") &
=else
%>
end if
%>
function buildSQLInsert( targetTable, omitFields)
iStr = "insert into " & targetTable & " "
vStr = "values ("
nStr = "("
Loop in the form collection and establish components of SQL statements
for each x in
fieldName = uCase(x)
Whether the judgment field is omitted?
if inStr(uCase(omitFields),x) = 0 then
fieldData = replace((fieldName), _
"", "")
If there is no data, insert NULL
if trim(fieldData) = "" then
fieldData = "NULL"
vStr = vStr & fieldData & ", "
nStr = nStr & fieldName & ", "
else
typeDelimPos = inStr(fieldName, "_")
if typeDelimPos = 0 then
Is a text field
Create a list of field names
nStr = nStr & fieldName & ", "
vStr = vStr &
[1] [2] [3] [4] [5] Next page
The db2 tutorial I am watching is: use form to submit SQL (transfer) 3. "" & fieldData & ", "else
Fields are other types
fieldType = left(fieldName, typeDelimPos - 1)
fieldName = mid(fieldName, typeDelimPos + 1)
Add the field name to the name list
nStr = nStr & fieldName & ", "
Turn field types into uppercase to ensure matching
select case uCase(fieldType)
case "NUM"
vStr = vStr & fieldData & ", "
Process unknown types as text types
case else
vStr = vStr & "" & fieldData & ", "
end select
end if
&
Previous page [1] [2] [3] [4] [5] Next page
The db2 tutorial I am watching is: use form to submit SQL (transfer) 3. nbsp; end ifend if
next
Remove the ending ", " from the string we created
vStr = left(vStr, len(vStr) - 2) & ")"
nStr = left(nStr, len(nStr) - 2) & ") "
Integrate SQL statements
buildSQLInsert = iStr & nStr & vStr
end function
if trim(request("fName")&request("lname")&request("age")) "" then
( buildSQLInsert("") & "
( buildSQLInsert("NUM_AGE") & "
")
( buildSQLInsert("lname,fname") & "
")
( buildSQLInsert("mycheckbox,fname") &
=else
%>
end if
%>
List D: The final version of the buildSQLInsert function.
function buildSQLInsert( targetTable, omitFields)
iStr = "insert into " & targetTable & " "
vStr = "values ("
nStr = "("
Loop in the form collection and establish components of SQL statements
for each x in
fieldName = uCase(x)
Whether the judgment field is omitted?
if inStr(uCase(omitFields),x) = 0 then
fieldData = replace((fieldName), _
"", "")
If there is no data, insert NULL
if trim(fieldData) = "" then
fieldData = "NULL"
vStr = vStr & fieldData & ", "
Previous page [1] [2] [3] [4] [5] Next page
The db2 tutorial I am watching is: use form to submit SQL (transfer) 3. nStr = nStr & fieldName & ", "else
typeDelimPos = inStr(fieldName, "_")
if typeDelimPos = 0 then
Is a text field
Create a list of field names
nStr = nStr & fieldName & ", "
vStr = vStr & "" & fieldData & ", "
else
Fields are other types
fieldType = left(fieldName, typeDelimPos - 1)
fieldName = mid(fieldName, typeDelimPos + 1)
Add the field name to the name list
nStr = nStr & fieldName & ", "
Turn field types into uppercase to ensure matching
select case uCase(fieldType)
&n
Previous page [1] [2] [3] [4] [5] Next page
The db2 tutorial I am watching is: use form to submit SQL (transfer) 3. bsp; case "NUM"vStr = vStr & fieldData & ", "
Process unknown types as text types
case else
vStr = vStr & "" & fieldData & ", "
end select
end if
end if
end if
next
Remove the ending ", " from the string we created
vStr = left(vStr, len(vStr) - 2) & ")"
nStr = left(nStr, len(nStr) - 2) & ") "
Integrate SQL statements
buildSQLInsert = iStr & nStr & vStr
end function
if trim(request("fName")&request("lname")&request("age")) "" then
( buildSQLInsert("") & "
( buildSQLInsert("NUM_AGE") & "
")
( buildSQLInsert("lname,fname") & "
")
( buildSQLInsert("mycheckbox,fname") &
=else
%>
end if
%>
Previous page [1] [2] [3] [4] [5]