本文介绍了关闭由Execute创建的ADO Recordset的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 当我打开ADO Recordset时,我将其关闭。但是,似乎有可能 以这种方式打开Recordset会有所不同: Dim rL As ADODB.Recordset 设置rL =新ADODB.Recordset src =" SELECT Count(*)FROM reviewer INNER JOIN pp_officer" &安培; _ " ON reviewer.reviewer_id = pp_officer.ppo_rev_id" &安培; _ " WHERE rev_login =''EllisonL''" 设置rL = CurrentProject.Connection.Execute(src,,adCmdText) c = rL.Fields(0) rL.Close 在这种类型的Recordset中,仍然需要Close语句 - 毕竟没有明确的开放? - Darryl Kerkeslager When I open an ADO Recordset, I close it. However, it seems that there maybe some difference in this manner of opening a Recordset: Dim rL As ADODB.RecordsetSet rL = New ADODB.Recordset src = "SELECT Count(*) FROM reviewer INNER JOIN pp_officer " & _"ON reviewer.reviewer_id = pp_officer.ppo_rev_id " & _"WHERE rev_login = ''EllisonL''"Set rL = CurrentProject.Connection.Execute(src, , adCmdText)c = rL.Fields(0)rL.Close In this type of Recordset, is the Close statement still necessary - thereis, after all, no explicit Open? --Darryl Kerkeslager推荐答案 如果查询返回行,则会创建记录集对象。非常肯定 应该关闭。 兰迪 If the query returns rows a recordset object is created. It very definitelyshould be closed. Randy 如果查询返回行,则会创建记录集对象。非常 If the query returns rows a recordset object is created. It very 绝对应该关闭。 Randy definitely should be closed. Randy BTW-如果你想在不创建 记录集对象的情况下检索数据(例如计数),可以使用GetString方法。 recCount = CurrentProject.Connection.Execute(src ).GetString BTW- If you want to retrieve data (such as a count) without creating arecordset object, you can use the GetString method. recCount = CurrentProject.Connection.Execute(src).GetString 这篇关于关闭由Execute创建的ADO Recordset的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-24 09:22