How to get the affected rows in VBA ADO Execute?

前端 未结 1 2021
一向
一向 2021-01-18 04:22

The following code errors on the MsgBox cn.RecordsAffected line with:

Arguments are of the wrong type, are out of acceptable range, or ar

1条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-18 05:10

    ADODB.Connection does not have a RecordsAffected property. However, the Execute method returns the affected records as a ByRef argument [MSDN]:

    Dim recordsAffected As Long
    cn.Execute "SELECT * INTO someschema.sometable FROM someschema.anothertable", _
               recordsAffected
    MsgBox recordsAffected    
    

    0 讨论(0)
提交回复
热议问题