I'm sending SQL queries from Excel VBA to MySQL, using ADODB. When sending queries for UPDATE, INSERT and DELETE, I would like to be able to return the number of rows affected in the DB, from my VBA function. How can I obtain the number of records affected post SQL execution?
Here's a sample code from a DELETE function:
Dim rs As New ADODB.Recordset
Dim strSQL As String
strSQL = "DELETE FROM mytable WHERE mycol>5;"
ConnectDB
rs.Open strSQL, ConnDB