?
Solved

Updating a second record set in VBS

Posted on 2005-03-19
6
Medium Priority
?
142 Views
Last Modified: 2010-04-06
I have captured the following numbers to a string called clients numbers as the record set was read

response.write(strClientNumbers) will give the following result
101,101,175,217,4303,1228,1259,615,615,1542,1542,222,1896,2636,424,2543,1228,924,3471,4600,4600,
the number of characters has been captured in the following
strCount
response.write(strCount) would give a value of 21

I am looking for some sort of loop to do the following to use these client number to update a second record set at the end of the ASP page.

sql="UPDATE client SET Newsletters='Newsletters Collected' WHERE [Client Number]=101"
sql="UPDATE client SET Newsletters='Newsletters Collected' WHERE [Client Number]=175"
sql="UPDATE client SET Newsletters='Newsletters Collected' WHERE [Client Number]=217"

etc

unless there is a way to update another record set when the record set that generated these client number is still open



0
Comment
Question by:kempvet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 2000 total points
ID: 13582400
try use the "IN" clause in your sql statement, so that you no need to have multiple sql statement to update your records, try like:

sql="UPDATE client SET Newsletters='Newsletters Collected' WHERE [Client Number] In (" & strClientNumbers & ") "
conn.execute sql
....

cheers
0
 
LVL 2

Expert Comment

by:donel
ID: 13589784
strClientNumbers is a string?

I am not sure on it ... if it was in array or string

for i=0 to 21
sql="UPDATE client SET Newsletters='Newsletters Collected' WHERE [Client Number]=" & strClientNumbers(i)
'here somthing to execute your sql
next i


I know it is not a big help, but small idea too.

Thanks !
Bj Mac Donel
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 13590482
It can be done by a loop just want donel mentioned above, but this will sacrifice the performance, since the field(s) to be updated is same.

so, by using a single sql that can performance the same thing will be the better choice.

Just my $0.02, cheers
0
 

Author Comment

by:kempvet
ID: 13590836
will try a few of these over the next couple of days - just a little pushed for time at the moment but I am sure the answer is in one of these replies, thanks
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question