473,394 Members | 2,168 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,394 software developers and data experts.

Multiple Update from text fields

Hello people I've recently been woring with multiple insert from text
fields and got that woking fine thanks to the help from people from
this forum
now i'm trying to deal with multiple update, I'm pretty much using the
same script but it isn't working properly
I have a text field in a form with a text field called color, in a
repeated region, that shows the amount of colours for the item that
your viewing
it submits to another page that handles spliting the querystring
putting it into an array and looping through them.
It does update all the records that have the same productID value but,
only with the last item in the array if the last text field contains
the value red it updates all fields with red that have the productID
of 32
here's the code
maybe the problem could be with my sql statement

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<!--#include file="../../Connections/conn.asp" -->
<%

var colorForm = String(Request.Form("color"));//get the form field and
put into var
colorForm = colorForm.replace(/'/g, "''");
colorForm_array = colorForm.split(",");//split at ","

if( colorForm !="undefined" ){
for( i=0 ; i < colorForm_array.length ; i ++){// loop through the
array
conn = Server.CreateObject('ADODB.Command');
conn.ActiveConnection = MM_conn_blenz_STRING;

conn.CommandText = ("UPDATE color SET color='" + colorForm_array[i] +
"' WHERE ProductID = 32" )

conn.Execute();
conn.ActiveConnection.Close();

}
}
Response.Redirect("UpdateMenu.asp?ProductID=32&uc= 1");

%>
Jul 19 '05 #1
1 2187
Roy,

First of all, what are you trying to do? Second, what does your table color
look like? From what you showed, a sample SQL string could be

UPDATE color SET color = 'White' WHERE ProductID = 32

This updates ALL records that have ProductID of 32. Therefore, the last such
SQL statement overrides all the ones before. You might want to have
additional WHERE conditions, something like:

UPDATE color SET color = 'White' WHERE ProductID = 32 AND ColorID = 55

Where 55 is dynamic.

--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com
"Roy Adams" <ro*******@ntlworld.com> wrote in message
news:13**************************@posting.google.c om...
Hello people I've recently been woring with multiple insert from text
fields and got that woking fine thanks to the help from people from
this forum
now i'm trying to deal with multiple update, I'm pretty much using the
same script but it isn't working properly
I have a text field in a form with a text field called color, in a
repeated region, that shows the amount of colours for the item that
your viewing
it submits to another page that handles spliting the querystring
putting it into an array and looping through them.
It does update all the records that have the same productID value but,
only with the last item in the array if the last text field contains
the value red it updates all fields with red that have the productID
of 32
here's the code
maybe the problem could be with my sql statement

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<!--#include file="../../Connections/conn.asp" -->
<%

var colorForm = String(Request.Form("color"));//get the form field and
put into var
colorForm = colorForm.replace(/'/g, "''");
colorForm_array = colorForm.split(",");//split at ","

if( colorForm !="undefined" ){
for( i=0 ; i < colorForm_array.length ; i ++){// loop through the
array
conn = Server.CreateObject('ADODB.Command');
conn.ActiveConnection = MM_conn_blenz_STRING;

conn.CommandText = ("UPDATE color SET color='" + colorForm_array[i] +
"' WHERE ProductID = 32" )

conn.Execute();
conn.ActiveConnection.Close();

}
}
Response.Redirect("UpdateMenu.asp?ProductID=32&uc= 1");

%>

Jul 19 '05 #2

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

Similar topics

7
by: Gary | last post by:
I haver a table of students - Say 100 students that I need to be able to update/delete and amend. I know I can do this one student at a time which is simple but lets say I want to see all the...
2
by: Colin Steadman | last post by:
Part No Description Quantity 45643 Random part 10 45678 Another Random part 7 98944 And another 1 <submit button> ...
0
by: Chris Hall | last post by:
The records in my database are displayed in a form as follows: %> <form action="report-ammend1.42.asp" method="post"name="form"> <table border=1> <% x = 1
7
by: Drew | last post by:
I have a db table like the following, UID, int auto-increment RegNo Person Relation YearsKnown Now here is some sample data from this table,
11
by: dskillingstad | last post by:
I've been struggling with this problem for some time and have tried multiple solutions with no luck. Let me start with, I'm a novice at Access and I'm not looking for someones help to design my...
8
by: Chris A via AccessMonster.com | last post by:
I have an interesting problem that I have yet to come accross that I can't change data structure on because it is an export from filemaker I am reformatting for another dept. anyway. I have a table...
4
neo008
by: neo008 | last post by:
Hi all, Finally gave up and putting it here. I am new to visual basic stucked up with an error- Run time errors.'-2147217887 (8004021)': Multiple-step operation generated errors. check each...
0
chumlyumly
by: chumlyumly | last post by:
Hello scripters - OS: Mac OSX Language: PHP w/ MySQL database I've created an insert page where a user inputs his info, which then goes to four different tables in a MySQL database. The...
7
by: john.cole | last post by:
I have searched all the groups I can, and I still haven't been able to come up the solution I need. I have the following problem. In my form named sbfrmSpoolList, I am entering a job, spool and...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
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...
0
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...

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.