SQL statement within a loop

Results 1 to 3 of 3

Thread: SQL statement within a loop

  1. #1
    Join Date
    Dec 1969

    Default SQL statement within a loop

    while not rsgroups.eof<BR> SQLCOUNT = "SELECT reqid As " & rsgroups(2) & "count FROM requests WHERE (prjstatus &#060;&#062; 4 AND prjstatus &#060;&#062; 5) AND " & rsgroups(2) & "req = 1"<BR> set rscount" & rsgroups(2) & " = conn.execute(SQLCOUNT)<BR>rsgroups.movenext<BR>wen d<BR><BR>I&#039;m trying to set line 3 to say "set rscount_____ = conn.execute(..."<BR><BR>whatever rsgroups(2) contains at that time.<BR><BR>How can this be done? any help is appreciated. i&#039;m probably overlooking the easy solution.<BR>

  2. #2
    Join Date
    Dec 1969

    Default kinda

    use an array of recordsets... rscount(rsgroups(2))<BR><BR>or at least that idea. not sure why you need to loop sqlstatements... but okay

  3. #3
    Join Date
    Dec 1969

    Default There's probably a better way

    The only reason I can think of to loop a SQL statement would be an INSERT or UPDATE. What&#039;s different about each SQL statement that makes you think you couldn&#039;t get all the data in one trip to the DB?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts