Results 1 to 4 of 4

Thread: How to detect how many records are updated??

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2002
    Posts
    2

    How to detect how many records are updated??

    I've the following codes in my program to update some records in a table, based on some conditions.
    ------------------------------------------------------------------------
    sql = "update tbl_cust set dept_id = '" & dept_id_new & "' where dept_id = 'A'"
    Set rs = conn.Execute(sql)
    ------------------------------------------------------------------------
    I want to find out the number of records updated after executing the above command, is it possible? Or is there an alternative way of finding out the number of records updated??

    Really desperate, please help, thanks in advance.

  2. #2
    Fanatic Member SkiNLaB's Avatar
    Join Date
    Jan 2002
    Location
    Sydney, Australia
    Posts
    747
    well here's a long way

    u retreive a recordset of the records that need to be updated, look at the recordcount, change the required values in the recordset and update...

  3. #3
    Addicted Member Pickler's Avatar
    Join Date
    May 2001
    Location
    nffanb
    Posts
    248
    VB Code:
    1. Dim Affected as Long
    2.  
    3. sql = "update tbl_cust set dept_id = '" & dept_id_new & "' where dept_id = 'A'"
    4. conn.Execute sql,Affected
    5. Debug.print Affected

  4. #4

    Thread Starter
    New Member
    Join Date
    Feb 2002
    Posts
    2

    Thumbs up How to detect how many records are updated??

    Originally posted by Pickler
    VB Code:
    1. Dim Affected as Long
    2.  
    3. sql = "update tbl_cust set dept_id = '" & dept_id_new & "' where dept_id = 'A'"
    4. conn.Execute sql,Affected
    5. Debug.print Affected
    Oh yes Pickler ! What you've recommended is exactly what I want!! Thank you so much.

    Thanks to you too, SkinLab.

Posting Permissions

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



Click Here to Expand Forum to Full Width