【发布时间】:2012-05-21 08:53:28
【问题描述】:
如何在记录集上使用 DAO 执行以下操作
SELECT TOP 1 * FROM foo WHERE id = 10 ORDER BY timestamp DESC
使用 SetCurrentIndex 您只能使用一个索引,否则使用 id 和 timestamp 并选择第一个索引会起作用。
【问题讨论】:
标签: c++ ms-access dao recordset
如何在记录集上使用 DAO 执行以下操作
SELECT TOP 1 * FROM foo WHERE id = 10 ORDER BY timestamp DESC
使用 SetCurrentIndex 您只能使用一个索引,否则使用 id 和 timestamp 并选择第一个索引会起作用。
【问题讨论】:
标签: c++ ms-access dao recordset
我不知道你想要什么。
Dim rs As DAO.Recordset
Dim db As Database
Set db = CurrentDB
sSQL = "SELECT TOP 1 * FROM foo WHERE id = 10 ORDER BY timestamp DESC"
Set rs = db.OpenRecordset(sSQL)
查找不适用于所有记录集。这将起作用:
Set rs = CurrentDb.OpenRecordset("select * from table1")
rs.FindFirst "akey=1 and atext='b'"
If Not rs.EOF Then Debug.Print rs!AKey
这不会:
Set rs = CurrentDb.OpenRecordset("table1")
rs.FindFirst "akey=1 and atext='b'"
【讨论】: