FORM表单里的下拉选项框
<select name="RsType<%=i%>" size="1" id="RsType<%=i%>">
<option value="AutoIncrement" <% if i=0 then response.Write("selected")%>>自动编号</option>
<option value="varchar" <% if i>0 then response.Write("selected")%>>文本</option>
<option value="text">text</option>
<option value="nchar">nchar</option>
<option value="nvarchar">nvarchar</option>
<option value="String">String</option>
<option value="memo">备注</option>
<option value="bit">bit位</option>
<option value="smallint">smallint2字节</option>
<option value="tinyint">tinyint</option>
<option value="int">int4字节</option>
<option value="Guid">同步复制ID</option>
<option value="uniqueidentifier">uniqueidentifier</option>
<option value="integer">长整型整数</option>
<option value="Long">Long</option>
<option value="short">整型整数</option>
<option value="real">单精度型整数</option>
<option value="Single">Single</option>
<option value="double">双精度型整数</option>
<option value="float">float</option>
<option value="double">字节型整数</option>
<option value="NUMERIC">小数numeric</option>
<option value="datetime">日期/时间</option>
<option value="smalldatetime">smalldatetime</option>
<option value="date">日期</option>
<option value="time">时间</option>
<option value="Currency">货币</option>
<option value="money">money</option>
<option value="smallmoney">smallmoney</option>
<option value="YesNo">是/否</option>
<option value="image">image</option>
<option value="Hyperlink">超链接</option>
<option value="OLEObject">OLE对象</option>
</select>
ASP处理代码
sql=""
RsName=cstr(trim(request("RsName"&i)))
RsType=cstr(trim(request("RsType"&i)))
RsLenth=trim(request("RsLenth"&i))
RsNull=cstr(trim(request("RsNull"&i)))
RsDefault=cstr(trim(request("RsDefault"&i)))
select case RsType
'Boolean、Integer、Long、Currency、Single、Double、Date、String 和 Variant(默认))。
case "AutoIncrement"
sql=sql&RsName&" AutoIncrement "&RsNull&","
case "bit" '未通过
sql=sql&RsName&" bit NOT NULL "
if RsDefault<>"" and RsDefault="1" then
sql=sql&" default 1,"
else
sql=sql&" default 0,"
end if
case "Boolean" '未通过
sql=sql&RsName&" Boolean NOT NULL "
if RsDefault<>"" and RsDefault="Yes" then
sql=sql&" default 1,"
elseif RsDefault<>"" and RsDefault="True" then
sql=sql&" default 1,"
elseif RsDefault<>"" and RsDefault<>"0" then
sql=sql&" default 1,"
else
sql=sql&" default 0,"
end if
case "String"
if RsLenth="" then
sql=sql&RsName&" String(50) "&RsNull
else
sql=sql&RsName&" String("&cint(RsLenth)&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default '"&RsDefault&"',"
else
sql=sql&","
end if
case "varchar"
if RsLenth="" then
sql=sql&RsName&" varchar(50) "&RsNull
else
sql=sql&RsName&" varchar("&cint(RsLenth)&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default '"&RsDefault&"',"
else
sql=sql&","
end if
case "nvarchar"
if RsLenth="" then
sql=sql&RsName&" nvarchar(50) "&RsNull
else
sql=sql&RsName&" nvarchar("&cint(RsLenth)&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default '"&RsDefault&"',"
else
sql=sql&","
end if
case "nchar"
if RsLenth="" then
sql=sql&RsName&" nchar(50) "&RsNull
else
sql=sql&RsName&" nchar("&cint(RsLenth)&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default '"&RsDefault&"',"
else
sql=sql&","
end if
case "text"
if RsLenth="" then
sql=sql&RsName&" text(50) "&RsNull
else
sql=sql&RsName&" text("&cint(RsLenth)&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default '"&RsDefault&"',"
else
sql=sql&","
end if
case "memo"
if RsDefault<>"" then
sql=sql&RsName&" memo "&" default '"&RsDefault&"',"
else
sql=sql&RsName&" memo "&RsNull&","
end if
case "integer"
if RsLenth="" then
sql=sql&RsName&" integer "&RsNull
else
sql=sql&RsName&" integer("&RsLenth&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default "&RsDefault&","
else
sql=sql&","
end if
case "float"
if RsLenth="" then
sql=sql&RsName&" float "&RsNull
else
sql=sql&RsName&" float("&RsLenth&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default "&RsDefault&","
else
sql=sql&","
end if
case "tinyint"
if RsLenth="" then
sql=sql&RsName&" tinyint "&RsNull
else
sql=sql&RsName&" tinyint("&RsLenth&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default "&RsDefault&","
else
sql=sql&","
end if
case "smallint"
if RsLenth="" then
sql=sql&RsName&" smallint "&RsNull
else
sql=sql&RsName&" smallint("&RsLenth&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default "&RsDefault&","
else
sql=sql&","
end if
case "int"
if RsLenth="" then
sql=sql&RsName&" int "&RsNull
else
sql=sql&RsName&" int("&RsLenth&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default "&RsDefault&","
else
sql=sql&","
end if
case "Long"
if RsLenth="" then
sql=sql&RsName&" Long "&RsNull
else
sql=sql&RsName&" Long("&RsLenth&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default "&RsDefault&","
else
sql=sql&","
end if
case "number"
if RsLenth="" then
sql=sql&RsName&" number "&RsNull
else
sql=sql&RsName&" number("&RsLenth&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default "&RsDefault&","
else
sql=sql&","
end if
case "short"
if RsLenth="" then
sql=sql&RsName&" short "&RsNull
else
sql=sql&RsName&" short("&RsLenth&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default "&RsDefault&","
else
sql=sql&","
end if
case "Single"
if RsLenth="" then
sql=sql&RsName&" Single "&RsNull
else
sql=sql&RsName&" Single("&RsLenth&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default "&RsDefault&","
else
sql=sql&","
end if
case "double"
if RsLenth="" then
sql=sql&RsName&" double "&RsNull
else
sql=sql&RsName&" double("&RsLenth&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default "&RsDefault&","
else
sql=sql&","
end if
case "real"
if RsLenth="" then
sql=sql&RsName&" real "&RsNull
else
sql=sql&RsName&" real("&RsLenth&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default "&RsDefault&","
else
sql=sql&","
end if
case "NUMERIC"
if RsLenth="" then
sql=sql&RsName&" NUMERIC "&RsNull
else
sql=sql&RsName&" NUMERIC("&RsLenth&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default "&RsDefault&","
else
sql=sql&","
end if
case "Replication"
sql=sql&RsName&" Replication,"
case "Guid"
sql=sql&RsName&" Guid,"
case "uniqueidentifier"
sql=sql&RsName&" uniqueidentifier,"
case "datetime" 'Access97支持
if RsDefault="" then
sql=sql&RsName&" datetime "&RsNull&","
else
sql=sql&RsName&" datetime "&RsNull&" default "&RsDefault&","
end if
case "smalldatetime" 'Access97支持
if RsDefault="" then
sql=sql&RsName&" smalldatetime "&RsNull&","
else
sql=sql&RsName&" smalldatetime "&RsNull&" default "&RsDefault&","
end if
case "date"
if RsDefault="" then
sql=sql&RsName&" date "&RsNull&","
else
sql=sql&RsName&" date "&RsNull&" default "&RsDefault&","
end if
case "time"
if RsDefault="" then
sql=sql&RsName&" time "&RsNull&","
else
sql=sql&RsName&" time "&RsNull&" default "&RsDefault&","
end if
case "YesNo"
if RsDefault="" then
sql=sql&RsName&" YesNo "&RsNull&","
else
sql=sql&RsName&" YesNo "&RsNull&" default "&RsDefault&","
end if
case "Currency"
if RsLenth="" then
sql=sql&RsName&" Currency "&RsNull
else
sql=sql&RsName&" Currency("&RsLenth&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default "&RsDefault&","
else
sql=sql&","
end if
case "money"
if RsLenth="" then
sql=sql&RsName&" money "&RsNull
else
sql=sql&RsName&" money("&RsLenth&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default "&RsDefault&","
else
sql=sql&","
end if
case "smallmoney"
if RsLenth="" then
sql=sql&RsName&" smallmoney "&RsNull
else
sql=sql&RsName&" smallmoney("&RsLenth&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default "&RsDefault&","
else
sql=sql&","
end if
case "Variant"'未通过
if RsDefault="" then
sql=sql&RsName&" Variant "&RsNull&","
else
sql=sql&RsName&" Variant "&RsNull&" default "&RsDefault&","
end if
case "Hyperlink"
if RsDefault="" then
sql=sql&RsName&" OLEObject "&RsNull&","
else
sql=sql&RsName&" OLEObject "&RsNull&" default "&RsDefault&","
end if
case "OLEObject"
if RsDefault="" then
sql=sql&RsName&" OLEObject "&RsNull&","
else
sql=sql&RsName&" OLEObject "&RsNull&" default "&RsDefault&","
end if
case "image"
if RsDefault="" then
sql=sql&RsName&" image "&RsNull&","
else
sql=sql&RsName&" image "&RsNull&" default "&RsDefault&","
end if
case else
response.write("<script>alert('数据类别"&RsType&"不可以识别或者暂时未完善此类别数据类型的建表功能,即将返回');location.href='CreateTable1224.asp';</script>")
response.End()
end select
sql1=sql1&sql
next
sql1=left(sql1,len(sql1)-1)&")"
response.Write(sql1)