473,499 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using variable in script

using access db and asp

i have a variable from a form
sRound = request.form("round") and for now let us say this value is 3

now i want to include that 3 in sql, but it is part of a field name which
is round3_report

cm.CommandText ="UPDATE rounds SET round" & sRound & "_report = '" & var5 &
"' WHERE Name ='" & sName & "' AND meeting = " & var4 & ""
cm.execute

this isn't working. i keep getting parameter error. i know there is a way to
join a word with a variable in order to make a field name in asp/sql, but I
don't remember how

can you help?
thanks
Dec 12 '05 #1
3 1164
Response.Write out the SQL query to see what's being passed.

Ray at work

"Jeff" <gi*****@adelphia.net> wrote in message
news:vJ********************@adelphia.com...
using access db and asp

i have a variable from a form
sRound = request.form("round") and for now let us say this value is 3

now i want to include that 3 in sql, but it is part of a field name which
is round3_report

cm.CommandText ="UPDATE rounds SET round" & sRound & "_report = '" & var5
& "' WHERE Name ='" & sName & "' AND meeting = " & var4 & ""
cm.execute

this isn't working. i keep getting parameter error. i know there is a way
to join a word with a variable in order to make a field name in asp/sql,
but I don't remember how

can you help?
thanks

Dec 12 '05 #2
Jeff wrote:
using access db and asp

i have a variable from a form
sRound = request.form("round") and for now let us say this value is 3

now i want to include that 3 in sql, but it is part of a field name
which is round3_report

cm.CommandText ="UPDATE rounds SET round" & sRound & "_report = '" &
var5 & "' WHERE Name ='" & sName & "' AND meeting = " & var4 & ""
cm.execute

this isn't working. i keep getting parameter error. i know there is a
way to join a word with a variable in order to make a field name in
asp/sql, but I don't remember how

can you help?
thanks

Instead of dynamic sql, use parameters:
http://groups-beta.google.com/group/...e36562fee7804e
Actually, I prefer using saved parameter queries:
http://groups.google.com/groups?hl=e...tngp13.phx.gbl

http://groups.google.com/groups?hl=e...TNGP11.phx.gbl

http://www.google.com/groups?selm=eE...&output=gplain

http://www.google.com/groups?hl=en&l...TNGP12.phx.gbl

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Dec 12 '05 #3
thanks to both of you. Especially for the links. both wwere a great help.
Bam
"Jeff" <gi*****@adelphia.net> wrote in message
news:vJ********************@adelphia.com...
using access db and asp

i have a variable from a form
sRound = request.form("round") and for now let us say this value is 3

now i want to include that 3 in sql, but it is part of a field name which
is round3_report

cm.CommandText ="UPDATE rounds SET round" & sRound & "_report = '" & var5
& "' WHERE Name ='" & sName & "' AND meeting = " & var4 & ""
cm.execute

this isn't working. i keep getting parameter error. i know there is a way
to join a word with a variable in order to make a field name in asp/sql,
but I don't remember how

can you help?
thanks

Dec 12 '05 #4

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

Similar topics

6
6725
by: Hansan | last post by:
Hi all. I am working on a webpage where I use python and html. When I want to send one variable to a new script/page I use the following code: 0) print '''<input type=hidden name="eventid"...
7
72107
by: Jonas Daunoravicius | last post by:
The subject pretty much sums up what I need to do. Here is what I have so far, but still can't figure out how to get it working: <script language="javascript" type="text/javascript"> function...
7
2808
by: NewbieJon | last post by:
I am attempting to send the variable "sComputerName" from my ActiveX script to "GetInfo.asp" using javascript. (Having been advised this is the way to get my ActiveX variable into my ASP script) ...
28
20270
by: Daniel | last post by:
Hello =) I have an object which contains a method that should execute every x ms. I can use setInterval inside the object construct like this - self.setInterval('ObjectName.methodName()',...
9
6880
by: Charley Kyd | last post by:
I'm a newbie who needs advice about how to use external files of JavaScript code. I spent an hour this afternoon browsing through JavaScript books at the local book store. In about 15 different...
15
3188
by: lawrence | last post by:
Sorry for the dumb question but I'm new to Javascript. I wrote this script hoping to animate some div blocks on a page. You can see the page here: http://www.keymedia.biz/demo.htm Can anyone...
7
10967
by: C.Joseph Drayton | last post by:
I have a problem that I am hoping someone can help me with. First let me describe the problem. I have an HTML form that in one field has an onBlur call to a JavaScript function. When you exit the...
6
5120
by: =?Utf-8?B?U2hhd24gU2VzbmE=?= | last post by:
Greetings! I was researching AJAX to provide a solution to displaying status messages while a long process executed. I found several examples online and was able to use their code to get a quick...
1
2856
by: bsprogs | last post by:
I am currnetly programming a file hosting website in PHP and I am slowly integrating AJAX into the website. Here is my problem: The user uploads the file. The server processes the file and...
13
12770
by: jkimbler | last post by:
As part of our QA of hardware and firmware for the company I work for, we need to automate some testing of devices and firmware. Since not everybody here knows C#, I'm looking to create a new...
0
7180
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
7229
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5485
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,...
0
4609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3108
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3103
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
311
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.