Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 143
  • Last Modified:

Updating a second record set in VBS

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
kempvet
Asked:
kempvet
  • 2
1 Solution
 
Ryan ChongCommented:
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
 
donelCommented:
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
 
Ryan ChongCommented:
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
 
kempvetAuthor Commented:
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

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now