Run an Update Query several times in a for loop

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lezilgeorge
    New Member
    • Feb 2008
    • 1

    Run an Update Query several times in a for loop

    I wanted to run an undate query in a for loop several times.....But When i run this only the 1 st row is getting updated and shows an error which says String or binary number is truncated, i am using the same record set object for this.is that a problem as the same name gets repeated in the loop
  • DrBunchman
    Recognized Expert Contributor
    • Jan 2008
    • 979

    #2
    Hi can you show us your code please?

    Thanks,

    Dr B

    Comment

    • jhardman
      Recognized Expert Specialist
      • Jan 2007
      • 3405

      #3
      I'm thinking that if you are doing a whole bunch of work in a single recordset you only need to update once, as soon as you finish your work. Show your code so far as DrB asks, and we can confirm.

      Jared

      Comment

      • markrawlingson
        Recognized Expert Contributor
        • Aug 2007
        • 346

        #4
        Well you'll definitely have to show your code as well as point out to us which line the error is thrown on.. But as a side-note - If you're doing a database update inside a loop like that I would suggest using the Connection.Exec ute(sSQL) method rather than opening a recordset - it's much faster and uses less resources. Cleaner code too.

        Sincerely,
        Mark

        Comment

        Working...