请求许多变量 [英] Requesting lots of variables
问题描述
大家好,
我不知道是否有人可以帮助我,
我有大约25个表格在一个站点中,每个表单上有10到70个字段,每个表单为
。现在,这些字段需要插入到数据库中,每个表单
都有它自己的表,每个列的名称都相同,因为它的对应是
对应的形式领域。有道理吗?
我的问题是,是否有更快的方法来构建我的SQL UPDATE
查询字符串?是否可以从单个页面请求所有表单
字段并将它们放入和数组中,我可以循环播放并快速构建SQL查询?或者我将以艰难的方式完成
并为每个表单字段执行request.form
并手动构建每个表单?
我有一个快速谷歌回合但是找不到任何东西
回答我的问题,
也许我只是在懒惰,但任何提示都会非常感激!
谢谢大家,
Tom
Hi everyone,
I don''t know if anyone can help me,
I''ve got roughly 25 forms in a site, with between 10 and 70 fields on
each form. Now, these fields need to be inserted into a DB, each form
has it''s own table and each column is named the same as it''s
corresponding form field. Make sense?
My question is, is there a quicker way of constructng my SQL UPDATE
query string for all this lot? Is it possible to request all the form
fields from a single page and put them into and array that I can loop
through and construct the SQL query on the fly? Or am I going to have
to do it the hard way and and do a request.form for every form field
and construct each one manually?
I''ve had a quick google round but can''t really find anything that
answers my question,
Maybe I''m just being lazy, but any tips would be really appreciated!
Thanks guys,
Tom
推荐答案
会话(" forms"& el)= Request.Form(el )
next
sql =" UPDATE myTab set"
dim昏迷
<在Session.Contents中每个el的
如果mid(el,1,5)=" forms"然后
sql = sql&昏迷& mid(el,6)&" =&& Session(el)coma =","
结束如果
next
Response.Write sql
汤姆 < SP ** @ tom-jordan.co.uk>在消息中写道
news:11 ********************** @ f14g2000cwb.googlegr oups.com ...
for each el in Request.Form
Session("forms"&el) = Request.Form(el)
next
sql = "UPDATE myTab set "
dim coma
for each el in Session.Contents
if mid(el,1,5) = "forms" then
sql = sql & coma & mid(el,6) &" = "& Session(el) coma = ","
end if
next
Response.Write sql
"Tom" <sp**@tom-jordan.co.uk> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
大家好,
我不知道是否有人可以帮助我,
我在一个网站上有大约25个表格,其中10个
每个表格上有70个字段。现在,需要将这些字段插入到数据库中,每个表单都有自己的表格,每个列的名称与其相应的表单字段相同。有道理吗?
我的问题是,是否有更快的方法来构建我的SQL UPDATE
查询字符串?是否可以从单个页面请求所有表单
字段并将它们放入和我可以循环的数组中并在运行中构建SQL查询?或者我将以艰难的方式完成它并为每个表单字段做一个request.form并手动构建每个表单?
我有过一个快速的谷歌回合,但真的找不到任何回答我的问题,
也许我只是在偷懒,但任何提示都会非常感激!
谢谢大家,
Tom
Hi everyone,
I don''t know if anyone can help me,
I''ve got roughly 25 forms in a site, with between 10 and 70 fields on
each form. Now, these fields need to be inserted into a DB, each form
has it''s own table and each column is named the same as it''s
corresponding form field. Make sense?
My question is, is there a quicker way of constructng my SQL UPDATE
query string for all this lot? Is it possible to request all the form
fields from a single page and put them into and array that I can loop
through and construct the SQL query on the fly? Or am I going to have
to do it the hard way and and do a request.form for every form field
and construct each one manually?
I''ve had a quick google round but can''t really find anything that
answers my question,
Maybe I''m just being lazy, but any tips would be really appreciated!
Thanks guys,
Tom
Brilliant - thx的快速反应
>
Brilliant - thx for the quick response too
" Tom" < SP ** @ tom-jordan.co.uk>在消息中写道
news:11 ******************** @ o13g2000cwo.googlegrou ps.com ...
"Tom" <sp**@tom-jordan.co.uk> wrote in message
news:11********************@o13g2000cwo.googlegrou ps.com...
很棒 - 快速反应也很快
Brilliant - thx for the quick response too
不用担心我猜你注意到那个
昏迷=","
应该是自己的线路
每个el在Request.Form
会话(表格& el )= Request.Form(el)
next
sql =" UPDATE myTab set"
Session昏暗昏迷
.Contents
如果mid(el,1,5)=" forms"然后
sql = sql&昏迷& mid(el,6)&" =&&会话(el)coma =","
结束如果
next
no worries I guess you noticed the that
coma = ","
should of been on its own line
for each el in Request.Form
Session("forms"&el) = Request.Form(el)
next
sql = "UPDATE myTab set "
dim coma
for each el in Session.Contents
if mid(el,1,5) = "forms" then
sql = sql & coma & mid(el,6) &" = "& Session(el) coma = ","
end if
next
这篇关于请求许多变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!