以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 高级功能研发区 (http://weistock.com/bbs/list.asp?boardid=5) ---- 关于VBS中RecordSet的Seek和Find (http://weistock.com/bbs/dispbbs.asp?boardid=5&id=49927) |
-- 作者:独行 -- 发布时间:2013/3/19 15:36:35 -- 关于VBS中RecordSet的Seek和Find 请教下客服,在Access的Mdb里,金字塔的VBS是否支持RecordSet记录集的Seek方法?如果支持,应该如何实现?本人测试了好久都没实现。 另外,在使用Find方法时,有时候会出现表里已有数据,但还是定位不了,直接报EOF错误。 多谢!! |
-- 作者:rushtaotao -- 发布时间:2013/3/19 16:09:58 -- 把你测试代码发出 我们看下 |
-- 作者:独行 -- 发布时间:2013/3/19 16:22:37 -- 多谢客服!测试代码如下: Sub TestSeek Set Cnn=CreateObject("Adodb.Connection") Rs.Seek vDate,1 if rs.eof then End Sub |
-- 作者:独行 -- 发布时间:2013/3/19 16:27:51 -- 错误提示:编译器错误 \'3251\' 当前提供程序不支持"索引"功能必须的界面。 |
-- 作者:王锋 -- 发布时间:2013/3/20 9:25:10 -- 这是百度上搜到的信息,希望读你有用
The Seek method searches the index of a Recordset to find a record that matches the values specified in the keyvalues parameter. If there is a match, the pointer will point to the record specified by the seekoption parameter. If there is no match, the record pointer will be placed at the end of the Recordset. Note: To use this method, the provider must support this method and the use of indexes on a Recordset (the Index property). Use the Supports method to determine whether the provider supports seek and indexes. Note: Set the Index property to the desired index before executing this method. Note: This method can only be used with server-side cursors (not supported when the CursorLocation property value is adUseClient). Note: This method can only be used when the Recordset object was opened with the CommandTypeEnum value of adCmdTableDirect. |
-- 作者:独行 -- 发布时间:2013/3/20 12:15:59 -- 谢谢王峰! 那些资料我都试过的。一直没有实现。adUseServer,CursorLocation,Support(Index),Support(Seek)都测试和设置的,这几项没有问题。但还是一直通不过。 唯一不能确定的是,CommandTypeEnum我使用的方法对不对。我是用的Rs.Open cnn,SelectStr,1,3,512的方式,不知道这种方式对不对。
|
-- 作者:王锋 -- 发布时间:2013/3/20 13:28:56 -- 试试将数据库表字段上加上索引和主键后看看。 ADO的开发都是一样的,你也考虑先在ACCESS上进行开发,等通过后再把代码移植到金字塔 |
-- 作者:独行 -- 发布时间:2013/3/20 15:42:30 -- 不指定索引的话,默认是使用主键。要Seek的字段就是主键。 实在是没招了
|
-- 作者:王锋 -- 发布时间:2013/3/20 15:45:45 -- 金字塔所用的VBA实际上是VBS引擎,开发ADO数据的代码完全一致,你也考虑在其他的有关数据的编程论坛递交一下这个问题。 |