我正在使用连接对象Execute()函数删除表中的条目。我无法获得受影响的行数。有人能帮忙吗?
Dim db As ADODB.Connection
db = OpenDatabase(ConnectionString)
deleteExams = "delete from [Table2] where [PlanDate] < '" & sDate & "'"
db.Execute(deleteExams)
db.Close()
adddb执行方法有一个受影响的行选项,参见https://learn.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)