I am deleting entries in table using Connection object Execute() function. I am unable to get numbers of rows affected. Could someone help?
Dim db As ADODB.Connection
db = OpenDatabase(ConnectionString)
deleteExams = "delete from [Table2] where [PlanDate] < '" & sDate & "'"
db.Execute(deleteExams)
db.Close()
CodePudding user response:
the ADIDB execte method has a affected rows option see https://docs.microsoft.com/de-de/sql/ado/reference/ado-api/execute-method-ado-connection?view=sql-server-ver16
Dim ObjAffectedrows As New Object
db.Execute(deleteExams, ObjAffectedrows)
Dim LongAfeected_Rows As Long = CLng(ObjAffectedrows)
Dim LongAfeectedRows As Long
Long.TryParse(ObjAffectedrows.ToString, LongAfeectedRows)