您的位置:首页精文荟萃软件资讯 → 如何用最简单的语句提交大量表单对象的值存储到数据库

如何用最简单的语句提交大量表单对象的值存储到数据库

时间:2004/10/7 19:17:00来源:本站整理作者:蓝点我要评论(0)


            
             
              
             
            

               
               

            



            如何用最简单的语句提交大量表单对象的值存储到数据库?说道这个问题可能大家经常遇到,感到很头痛,但是又没办法,只能慢慢写,笔者以提交一张应聘表单的提交为例给大家介绍如何用最简短的语句来达到目的
脚本运行通过环境环境:
iis5.0+sqlserver2000(当然也可以access2000等)

如有任何问题或建议请发email:chenxingbai@21cn.com
生成表结构的脚本
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[yingpin]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[yingpin]
GO

CREATE TABLE [dbo].[yingpin] (
[id] [int] IDENTITY (1, 1) NOT NULL ,
[yp_ name] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
[sex] [varchar] (4) COLLATE Chinese_PRC_CI_AS NULL ,
[birthday] [varchar] (15) COLLATE Chinese_PRC_CI_AS NULL ,
[health] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[hunyin] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[zhengzhi] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[xueli] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[zhicheng] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[english] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[email] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[phone] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[yp_ address] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
[zip] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[colledge] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[zhuanye] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[bumen] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[gangwei1] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[gangwei2] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[x_shijian] [varchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
[x_address] [varchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
[x_zhiwu] [varchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
[g_shijian] [varchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
[g_address] [varchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
[g_zhiwu] [varchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
[h_name] [varchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
[h_guanxi] [varchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
[h_danwei] [varchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
[h_zhiwu] [varchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
[pingjia] [varchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
[shexiang] [varchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
[beizhu] [varchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
[shijian] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[yingpin] WITH NOCHECK ADD
CONSTRAINT [DF_yingpin_shijian] DEFAULT (getdate()) FOR [shijian],
CONSTRAINT [PK_yingpin] PRIMARY KEY CLUSTERED
(
[id]
) ON [PRIMARY]
GO


Asp脚本addyp.asp




<%
if request("action")="add" then
dim str,strvalue,strname,i,str1
str="yp_name,sex,birthday,health,hunyin,zhengzhi,xueli,zhicheng,english,email,phone,yp_address,zip,colledge,zhuanye,bumen,gangwei1,gangwei2,x_shijian,x_address,x_zhiwu,g_shijian,g_address,g_zhiwu,h_name,h_guanxi,h_danwei,h_zhiwu,pingjia,shexiang,beizhu"
str1="x_shijian,x_address,x_zhiwu,g_shijian,g_address,g_zhiwu,h_name,h_guanxi,h_danwei,h_zhiwu"
strname=split(str,",")

for i=lbound(strname) to ubound(strname)
if i<>ubound(strname) then
if instr(str1,strname(i))=0 then
if trim(request.Form(strname(i)))="" then
response.write ""
response.End()
end if
sql=sql&"'"&trim(request.Form(strname(i)))&"',"
else
j=1
much=trim(request.Form(cstr(strname(i)&j)))
for j=2 to 5
much=much&"|"&trim(request.Form(cstr(strname(i)&j)))
next
sql=sql&"'"&much&"',"
end if
else
if trim(request.Form(strname(i)))="" then
response.write ""
response.End()
end if
sql=sql&"'"&trim(request.Form(strname(i)))&"'"
end if
next
sql="insert into yingpin ("&str&") values ("&sql&")"

conn.Execute(Sql)
if Err <> 0 Then
response.write ""

else
response.write ""

end If
end if
%>




gsjj




   





:::::::诚邀加盟:::::::












































































































id=fps7>姓   名
name="name" onFocus="this.select()"
onMouseOver="this.focus()" size="12"
>
*  性别
name="sex" onFocus="this.select()"
onMouseOver="this.focus()" size="4"

type=text>
*    出生年月
type=text id="birthday"
onFocus="this.select()"
onMouseOver="this.focus()" size="16"
>
* 
id=fps7>健康状况
name="health" onFocus="this.select()"
onMouseOver="this.focus()" size="8"
>
*  婚姻状况
name="hunyin" onFocus="this.select()"
onMouseOver="this.focus()" size="6"

type=text>
*   政治面貌
name="zhengzhi" onFocus="this.select()"
onMouseOver="this.focus()" size="16"

type=text>
*
最高学历
name="xueli" onFocus="this.select()"
onMouseOver="this.focus()" size="10"
>
* 职称
name="zhicheng" onFocus="this.select()"
onMouseOver="this.focus()" size="8"

type=text>
*   外语水平
name="english" onFocus="this.select()"
onMouseOver="this.focus()" size="16"

type=text>
*
E - MAIL
name="email" onFocus="this.select()"
onMouseOver="this.focus()" size="30"
>
* 电  话
name="phone" onFocus="this.select()"
onMouseOver="this.focus()" size=16
>
*
联系地址
name="address" onFocus="this.select()"
onMouseOver="this.focus()" size="30"
>
* 邮政编码
name="zip" onFocus="this.select()"
onMouseOver="this.focus()" size="16"

type=text>
*
id=fps7>毕业院校
name="colledge" onFocus="this.select()"
onMouseOver="this.focus()" size="30"
>
* 专  业
name="zhuanye" onFocus="this.select()"
onMouseOver="this.focus()" size=16
>
*
应聘部门id=fps7>
name="bumen" onFocus="this.select()"
onMouseOver="this.focus()" size=10
>
id=fps7>*应聘岗位id=fps7>
name="gangwei1" onFocus="this.select()"
onMouseOver="this.focus()" size=12
>
id=fps7>*第二应聘岗位id=fps7>
name="gangwei2" onFocus="this.select()"
onMouseOver="this.focus()" size=12
>
*












     起止时间           学校          
  职务
id=fps7>  
name="x_shijian1" onFocus="this.select()"
onMouseOver="this.focus()" size="18"
>
   
name="x_address1" onFocus="this.select()"
onMouseOver="this.focus()" size="20"
>
  
name="x_zhiwu1" onFocus="this.select()"
onMouseOver="this.focus()" size="10"
>
id=fps7> 
name="x_shijian2" onFocus="this.select()"
onMouseOver="this.focus()" size="18"
>
   
name="x_address2" onFocus="this.select()"
onMouseOver="this.focus()" size="20"
>
  
name="x_zhiwu2" onFocus="this.select()"
onMouseOver="this.focus()" size="10"
>
id=fps7> 
name="x_shijian3" onFocus="this.select()"
onMouseOver="this.focus()" size="18"
>
   
name="x_address3" onFocus="this.select()"
onMouseOver="this.focus()" size="20"
>
  
name="x_zhiwu3" onFocus="this.select()"
onMouseOver="this.focus()" size="10"
>
id=fps7> 
name="x_shijian4" onFocus="this.select()"
onMouseOver="this.focus()" size="18"
>
   
name="x_address4" onFocus="this.select()"
onMouseOver="this.focus()" size="20"
>
  
name="x_zhiwu4" onFocus="this.select()"
onMouseOver="this.focus()" size="10"
>
id=fps7> 
name="x_shijian5" onFocus="this.select()"
onMouseOver="this.focus()" size="18"
>
   
name="x_address5" onFocus="this.select()"
onMouseOver="this.focus()" size="20"
>
  
name="x_zhiwu5" onFocus="this.select()"
onMouseOver="this.focus()" size="10"
>













     起止时间           供职单位         
 职务
id=fps7>  
name="g_shijian1" onFocus="this.select()"
onMouseOver="this.focus()" size="18"
>
   
name="g_address1" onFocus="this.select()"
onMouseOver="this.focus()" size="20"
>
  
name="g_zhiwu1" onFocus="this.select()"
onMouseOver="this.focus()" size="10"
>
id=fps7> 
name="g_shijian2" onFocus="this.select()"
onMouseOver="this.focus()" size="18"
>
   
name="g_address2" onFocus="this.select()"
onMouseOver="this.focus()" size="20"
>
  
name="g_zhiwu2" onFocus="this.select()"
onMouseOver="this.focus()" size="10"
>
id=fps7> 
name="g_shijian3" onFocus="this.select()"
onMouseOver="this.focus()" size="18"
>
   
name="g_address3" onFocus="this.select()"
onMouseOver="this.focus()" size="20"
>
  
name="g_zhiwu3" onFocus="this.select()"
onMouseOver="this.focus()" size="10"
>
id=fps7> 
name="g_shijian4" onFocus="this.select()"
onMouseOver="this.focus()" size="18"
>
   
name="g_address4" onFocus="this.select()"
onMouseOver="this.focus()" size="20"
>
  
name="g_zhiwu4" onFocus="this.select()"
onMouseOver="this.focus()" size="10"
>
id=fps7> 
name="g_shijian5" onFocus="this.select()"
onMouseOver="this.focus()" size="18"
>
   
name="g_address5" onFocus="this.select()"
onMouseOver="this.focus()" size="20"
>
  
name="g_zhiwu5" onFocus="this.select()"
onMouseOver="this.focus()" size="10"
>






























   姓名     与本人关系       
工作单位           职务

name="h_name1" onFocus="this.select()"
onMouseOver="this.focus()" size="10"
>

name="h_guanxi1" onFocus="this.select()"
onMouseOver="this.focus()" size="10"
>

name="h_danwei1" onFocus="this.select()"
onMouseOver="this.focus()" size="28"
>

name="h_zhiwu1" onFocus="this.select()"
onMouseOver="this.focus()" size="10"
>
id=fps7>
name="h_name2" onFocus="this.select()"
onMouseOver="this.focus()" size="10"
>
id=fps7>
name="h_guanxi2" onFocus="this.select()"
onMouseOver="this.focus()" size="10"
>
id=fps7>
name="h_danwei2" onFocus="this.select()"
onMouseOver="this.focus()" size="28"
>

name="h_zhiwu2" onFocus="this.select()"
onMouseOver="this.focus()" size="10"
>
id=fps7>
name="h_name3" onFocus="this.select()"
onMouseOver="this.focus()" size="10"
>
id=fps7>
name="h_guanxi3" onFocus="this.select()"
onMouseOver="this.focus()" size="10"
>
id=fps7>
name="h_danwei3" onFocus="this.select()"
onMouseOver="this.focus()" size="28"
>

name="h_zhiwu3" onFocus="this.select()"
onMouseOver="this.focus()" size="10"
>
id=fps7>
name="h_name4" onFocus="this.select()"
onMouseOver="this.focus()" size="10"
>
id=fps7>
name="h_guanxi4" onFocus="this.select()"
onMouseOver="this.focus()" size="10"
>
id=fps7>
name="h_danwei4" onFocus="this.select()"
onMouseOver="this.focus()" size="28"
>

name="h_zhiwu4" onFocus="this.select()"
onMouseOver="this.focus()" size="10"
>
id=fps7>
name="h_name5" onFocus="this.select()"
onMouseOver="this.focus()" size="10"
>
id=fps7>
name="h_guanxi5" onFocus="this.select()"
onMouseOver="this.focus()" size="10"
>
id=fps7>
name="h_danwei5" onFocus="this.select()"
onMouseOver="this.focus()" size="28"
>

name="h_zhiwu5" onFocus="this.select()"
onMouseOver="this.focus()" size="10"
>














id=fps7>*
对未来工作的设想或其它需要补充的内容


id=fps7>*
备注(工作地点、薪金期望等):


id=fps7>*
&nbsp;


        















相关阅读 Windows错误代码大全 Windows错误代码查询激活windows有什么用Mac QQ和Windows QQ聊天记录怎么合并 Mac QQ和Windows QQ聊天记录Windows 10自动更新怎么关闭 如何关闭Windows 10自动更新windows 10 rs4快速预览版17017下载错误问题Win10秋季创意者更新16291更新了什么 win10 16291更新内容windows10秋季创意者更新时间 windows10秋季创意者更新内容kb3150513补丁更新了什么 Windows 10补丁kb3150513是什么

文章评论
发表评论

热门文章 360快剪辑怎么使用 36金山词霸如何屏幕取词百度收购PPS已敲定!3

最新文章 微信3.6.0测试版更新了微信支付漏洞会造成哪 360快剪辑怎么使用 360快剪辑软件使用方法介酷骑单车是什么 酷骑单车有什么用Apple pay与支付宝有什么区别 Apple pay与贝贝特卖是正品吗 贝贝特卖网可靠吗

人气排行 xp系统停止服务怎么办?xp系统升级win7系统方电脑闹钟怎么设置 win7电脑闹钟怎么设置office2013安装教程图解:手把手教你安装与qq影音闪退怎么办 QQ影音闪退解决方法VeryCD镜像网站逐个数,电驴资料库全集同步推是什么?同步推使用方法介绍QQ2012什么时候出 最新版下载EDiary——一款好用的电子日记本