473,397 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Can you use dynamic data in a request form

Hi, I am am trying to write some code to perform a INSERT in SQL table using
a loop. What would be great is a way of dynamically entering in data in a
requaest.form
ie the final code should look something like:
if Request.Form("type1") = "1" then
where the 1 in "type1" is dynamic so the code would look something like
Request.Form("type" & Rs.("fld_type_id") & ") = "1" then

But not sure how to form this or whether it would work, anyone have any
idea?
Jul 19 '05 #1
2 1518
bateman wrote:
Hi, I am am trying to write some code to perform a INSERT in SQL
table using a loop. What would be great is a way of dynamically
entering in data in a requaest.form
ie the final code should look something like:
if Request.Form("type1") = "1" then
where the 1 in "type1" is dynamic so the code would look something
like
Request.Form("type" & Rs.("fld_type_id") & ") = "1" then

But not sure how to form this or whether it would work, anyone have
any idea?


Of course it would work. All you need inside the parntheses is a string
containing the name of the variable. How that string is built is irrelevant.

sVar = "type" & Rs.("fld_type_id")
if Request.Form(sVar) = "1" then

Or, if you want to fly by the seat of your pants:
if Request.Form("type" & Rs.("fld_type_id") ) = "1" then

HTH,
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #2
"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:eR*************@TK2MSFTNGP12.phx.gbl...
bateman wrote:
Hi, I am am trying to write some code to perform a INSERT in SQL
table using a loop. What would be great is a way of dynamically
entering in data in a requaest.form
ie the final code should look something like:
if Request.Form("type1") = "1" then
where the 1 in "type1" is dynamic so the code would look something
like
Request.Form("type" & Rs.("fld_type_id") & ") = "1" then

But not sure how to form this or whether it would work, anyone have
any idea?
Of course it would work. All you need inside the parntheses is a string
containing the name of the variable. How that string is built is

irrelevant.
sVar = "type" & Rs.("fld_type_id")
if Request.Form(sVar) = "1" then

Or, if you want to fly by the seat of your pants:
if Request.Form("type" & Rs.("fld_type_id") ) = "1" then


Million Thanks, works perfectly
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Kingdom | last post by:
I'm using this script to dynamicaly populate 2 dropdowns and dispaly the results. Choose a component type from the first drop down, lets say 'car' and the second box will list all the car...
2
by: Nick | last post by:
Loop to create an array from a dynamic form. I'm having trouble with an application, and I'll try to explain it as clearly as possible: 1. I have a form with two fields, say Apples and...
7
by: Jack | last post by:
Hi, I am trying to test a sql statement in Access which gives me the error as stated in the heading. The sql statement is built as a part of asp login verification, where the userid and password...
0
by: Pat Patterson | last post by:
I'm having serious issues with a page I'm developing. I just need some simple help, and was hoping someone might be able to help me out in here. I have a form, that consists of 3 pages of...
0
by: Martin | last post by:
Hi. I had a very frustrating afternoon and evening but I have got it all under control now so all of a sudden I am in a good mood. I want to share some insights on output caching with you lot. ...
6
by: 35th Ave Media | last post by:
Hello, I have about 60+ pages that I need to insert a MAILTO: tag so people can email the page using their email client. The body of the message is going to be the URL of that page. Using ASP,...
7
by: CanoeGuy | last post by:
I have been trying for the last two weeks to display a dynamic DataGrid. The data that I'm pulling from a SQL Server DB will have whole columns that will be either NULL or 0. I want to display...
0
bmallett
by: bmallett | last post by:
First off, i would like to thank everyone for any and all help with this. That being said, I am having a problem retrieving/posting my dynamic form data. I have a form that has multiple options...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.