记录集仅返回 1000 条记录
我正在使用 LDAP 查询执行 ADODB recordset.open() 命令,以从 Active Directory 获取所有用户。
大约有 2600 个用户,但我只返回了其中的 1000 个。
我尝试更改记录集的 PageSize 和 MaxRecords 属性,但没有成功。
如果没有无关的东西,代码就是这样的(我已经将连接详细信息设为通用):
ADODB.Connection conn = new ADODB.Connection();
ADODB.Recordset rs = new ADODB.Recordset();
rs.MaxRecords = 10000;
rs.PageSize = 10000;
conn.Open("Active Directory Provider","","",0);
string query = "SELECT cn FROM 'LDAP://OU=User Accounts,OU=TopLevel,DC=domainName,DC=local' where samAccountName = '*'"
rs.Open(query, conn, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic, -1);
它肯定只返回 1000 条记录(我已经确认),并且我可以很好地访问它们。
如果它有帮助的话,我不使用 DirectorySearcher 的原因是因为与此相比它太慢。
I'm doing an ADODB recordset.open() command with an LDAP query to get all the users from my Active Directory.
There are about 2600 users, but I'm only getting back 1000 of them.
I've tried altering the recordset's PageSize and MaxRecords properties with no luck.
Without extraneous stuff, this is what the code looks like (I've made the connection details generic):
ADODB.Connection conn = new ADODB.Connection();
ADODB.Recordset rs = new ADODB.Recordset();
rs.MaxRecords = 10000;
rs.PageSize = 10000;
conn.Open("Active Directory Provider","","",0);
string query = "SELECT cn FROM 'LDAP://OU=User Accounts,OU=TopLevel,DC=domainName,DC=local' where samAccountName = '*'"
rs.Open(query, conn, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic, -1);
It's definitely only returning 1000 records, (I've confirmed), and I can access them just fine.
In case it helps, the reason I'm not using DirectorySearcher is because it's so slow in comparison to this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须在连接上设置页面大小,而不是在
Recordset
上设置。参考:
http://social. msdn.microsoft.com/Forums/en-US/vbgeneral/thread/e483c098-b2c1-4037-b9fb-3c882f3b14c4
http://support.microsoft.com/?kbid=243281
You have to set the page size on connection, not on the
Recordset
.Ref:
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/e483c098-b2c1-4037-b9fb-3c882f3b14c4
http://support.microsoft.com/?kbid=243281
此处讨论了 1000 条限制 - 本质上,它是固定在服务器上的,因此您需要跟店主谈谈...
The 1000 limit is discussed here - essentially, it is fixed at the server, so you're going to need to speak to the owner...