473,750 Members | 2,559 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems Using UPDATE to modify multiple and non sequential records - a giant conundrum from a total novice....

The records in my database are displayed in a form as follows:
%>
<form action="report-ammend1.42.asp" method="post"na me="form">
<table border=1>

<%

x = 1
while RS.EOF=false
%>
<tr><td><inpu t type="hidden" name="SprogNo<% = x %>"
value="<%Respon se.Write RS.Fields("Spro gNo")%>"><% response.write
(RS.Fields("Spr ogNo"))%></td>
<td><input type="text" name="Report<%= x %>" value="<%Respon se.Write
RS.Fields("Repo rt")%>"></td>
<td><input type="text" name="rep2<%= x %>" value="<%Respon se.Write
RS.Fields("rep2 ")%>"></td></tr>

<%
x = x + 1
RS.movenext
Wend
By specifying integer values for x in the form action file, the
correct data is always udated to the correct record:

Dim DB

Set DB = Server.CreateOb ject ("ADODB.Connect ion")
DB.Open ("PROVIDER=Micr osoft.Jet.OLEDB .4.0;DATA
SOURCE=C:\Inetp ub\wwwroot\test \test.mdb")
'Dim rs
Set rs = Server.CreateOb ject ("ADODB.Records et")
rs.Open "SELECT * FROM SprogTbl", DB, 2, 2
rs.movefirst
for x = 1 to 3
rs.Fields("Spro gNo") = Request.Form("S progNo" & x)
rs.Fields("Repo rt") = Request.Form("R eport" & x)
rs.Fields("rep2 ") = Request.Form("r ep2" & x)
rs.update
RS.movenext
Next
rs.movefirst
However, I need this to work for any (undefined) no. of records and
the records may have been queried to display non-sequential records
for the database.
I can't make any of the three solutions I can think of work:
1. If I could make the field SprogNo (which contains the unique ID
no.) rs.response write into x as an integer, then each record would be
automatically numbered. I would then need some kind of "for each x"
loop before the rs.update statements. Just putting:

Response.Write RS.Fields("Spro gNo")=x

in place of x = x+1 doesn't do it........

2. I've also tried tying the update to a WHERE statement. But, the
following will work for a databse of one record only:

Dim strSQL
strSQL = "UPDATE SprogTbl SET Report = '" & Report & _
"', rep2 = '" & rep2 & _
"' WHERE ((SprogTbl.Spro gNo)='" & SprogNo & "');"
DB.execute(strS QL)

..... however, I've had no success trying to iterate it's functions
starting with rs.movefirst and then a while rs.EOF=false 'rs.movenext
loop.

3. Finally, I thought it might be worth trying to get the WHERE
statement (above) into the rs.Fields("Spro gNo") =
Request.Form("S progNo" & x) statement. So far all attempts have fallen
foul of syntax errors. e.g. rs.update WHERE ((SprogTbl.Spro gNo)='" &
SprogNo & "');
The last two solutions would still require making the update repeat
for each of the fields in some kind of a loop.

Any help gratefully recieved......
Jul 19 '05 #1
0 2406

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

Similar topics

7
5657
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 students on the screen at the same time, modify some, mark some for deletion and even have blank fields at the end to add a new record. In HTML which is generated I label each row and input field with a name/number combination i.e <input type=text...
0
1313
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
2
6268
by: mb12036 | last post by:
All- Having a problem installing a DB2 client on a machine running AIX version 5.0. Client appeared to install one time succesfully, then was uninstalled and a reinstall was attempted. For some reasons, it does not complete the reinstall. See the status report from the GUI installer at the end of this note. Errors are towards the bottom. Everything installed in /usr/opt for DB2 but the sqllib folder that is supposed to be created in...
8
3724
by: Maxi | last post by:
There is a lotto system which picks 21 numbers every day out of 80 numbers. I have a table (name:Lotto) with 22 fields (name:Date,P1,P2....P21) Here is the structure and sample data: "Date","P1","P2","P3","P4","P5","P6","P7","P8","P9","P10","P11","P12","P13","P14","P15","P16","P17","P18","P19","P20","P21" 1/1/2005,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21 1/2/2005,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22
19
4165
by: eric.nave | last post by:
this is a slight change to a fequently asked question around here. I have a table which contains a "sortorder" column where a user can specify some arbitrary order for records to be displayed in. Users have sometimes ordered records the way we used to number lines in a BASIC program (10,20,30, etc.). I'd like to do an update query and fix this so that every record is in sequential order. I found an example in this newsgroup of how to...
9
3062
by: Kelii | last post by:
I've been trying to get this piece to work for a few hours, but have given up. I hope someone out there can help, I think the issue is relatively straightforward, but being a novice, I'm stumped. Below you will find the code I've written and the error that results. I'm hoping that someone can give me some direction as to what syntax or parameter is missing from the code that is expected by VBA. Overview: I'm trying to copy calculated...
7
3335
by: =?Utf-8?B?V2FubmFiZQ==?= | last post by:
Is there a way to use a gridview in a timecard application, and if so, how? I was looking at using a gridview to display a person's hours worked in a week. To do this, many different data records would have to display on the same row to make up a week (the database has a new row for each day entered). But, from what I can tell, this keeps you from being able to use a gridview, because the gridview relies on one datakey per row (and there...
8
2983
by: Michel Esber | last post by:
Hello, Env: DB2 V8 LUW FP16 running Linux create Table X (machine_id varchar(24) not null, ctime timestamp not null); create index iFoo on X (MACHINE_ID, CTIME) allow reverse scans; alter table X add primary key (MACHINE_ID, CTIME); Our C++ application inserts data into a table X using CLI array insert
4
5291
by: phill86 | last post by:
Hi, i have a form that runs a query in a recordset on the after update method if i copy and paste one record at a time the query picks up the records in the underlying table but if i paste multiple records the query fails to pick up the set of pasted records i think the after update method is running before the table is properly updated when i paste a group of records I have also tried running the code from the after insert method with no...
0
9001
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9584
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9398
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9345
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9257
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8265
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6811
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6081
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4894
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.