Submit SQL (to) with table forms 3_DB2

Source: Internet
Author: User
Tags db2 prev trim
The DB2 tutorial you are looking at is: Submit SQL (EXT) 3 with a table forms. List D:buildsqlinsert The final version of the function.


<%
function Buildsqlinsert (targettable, Omitfields)
ISTR = "INSERT INTO" & Targettable & ""
Vstr = "VALUES ("
Nstr = "("
Looping through a collection of forms and building up parts of SQL statements
For each x in Request.Form
FieldName = uCase (x)
Determine if the field is omitted?
If InStr (UCase (Omitfields), x) = 0 Then
Fielddata = replace (Request.Form (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 you are looking at is: Submit SQL (EXT) 3 with a table forms. "" & Fielddata & ","
Else
fields are other types
FieldType = Left (FieldName, typeDelimPos-1)
FieldName = Mid (FieldName, Typedelimpos + 1)
Add field name to Name list
Nstr = nstr & FieldName & ","
Capitalize field type to ensure match
Select Case UCase (FieldType)
Case "NUM"
Vstr = vstr & Fielddata & ","
To treat unknown types as text
Case Else
Vstr = Vstr & "" & Fielddata & ","
End Select
End If
&

prev [1] [2] [3] [4] [5] Next page

The DB2 tutorial you are looking at is: Submit SQL (EXT) 3 with a table forms.                      nbsp End If
End If
Next

Remove the end of the "," from the string we established
Vstr = Left (Vstr, Len (VSTR)-2) & ")"
Nstr = Left (Nstr, Len (NSTR)-2) & ")"

Integrate the SQL statements
Buildsqlinsert = ISTR & Nstr & Vstr
End Function


If Trim (Request ("FName") &request ("lname") &request ("Age") <> "" Then
Response.Write (Buildsqlinsert ("") & " Response.Write (Buildsqlinsert ("Num_age") & "
")
Response.Write (Buildsqlinsert ("Lname,fname") & "
")
Response.Write (Buildsqlinsert ("Mycheckbox,fname") &
=< " Else
%>




Gimme your:

The Name:

Last Name:

Age:








<%
End If
%>




List D:buildsqlinsert The final version of the function.


<%
function Buildsqlinsert (targettable, Omitfields)
ISTR = "INSERT INTO" & Targettable & ""
Vstr = "VALUES ("
Nstr = "("
Looping through a collection of forms and building up parts of SQL statements
For each x in Request.Form
FieldName = uCase (x)
Determine if the field is omitted?
If InStr (UCase (Omitfields), x) = 0 Then
Fielddata = replace (Request.Form (fieldName), _
"", "")
If there is no data, insert NULL
If trim (fielddata) = "" Then
Fielddata = "NULL"
Vstr = vstr & Fielddata & ","

prev [1] [2] [3] [4] [5] Next page

The DB2 tutorial you are looking at is: Submit SQL (EXT) 3 with a table forms. 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 field name to Name list
Nstr = nstr & FieldName & ","
Capitalize field type to ensure match
Select Case UCase (FieldType)
&n

prev [1] [2] [3] [4] [5] Next page

The DB2 tutorial you are looking at is: Submit SQL (EXT) 3 with a table forms.     Bsp Case "NUM"
Vstr = vstr & Fielddata & ","
To treat unknown types as text
Case Else
Vstr = Vstr & "" & Fielddata & ","
End Select
End If
End If
End If
Next

Remove the end of the "," from the string we established
Vstr = Left (Vstr, Len (VSTR)-2) & ")"
Nstr = Left (Nstr, Len (NSTR)-2) & ")"

Integrate the SQL statements
Buildsqlinsert = ISTR & Nstr & Vstr
End Function


If Trim (Request ("FName") &request ("lname") &request ("Age") <> "" Then
Response.Write (Buildsqlinsert ("") & " Response.Write (Buildsqlinsert ("Num_age") & "
")
Response.Write (Buildsqlinsert ("Lname,fname") & "
")
Response.Write (Buildsqlinsert ("Mycheckbox,fname") &
=< " <><>
Else
%>




Gimme your:

The Name:

Last Name:

Age:








<%
End If
%>

prev [1] [2] [3] [4] [5]

<>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.