有没有办法通过SqlDataReader(或任何其他C#ADO.NET对象)填充数组而不循环遍历所有项目?我有一个返回单个列的查询,我想将它放入一个字符串数组(或ArrayList,或List等).
我见过CGI/Perl的每个例子基本上是一堆包含HTML的打印语句,这似乎不是编写CGI应用程序的最佳方式.有一个更好的方法吗?谢谢.
编辑:我决定使用CGI :: Application和HTML :: Template,并使用以下教程: http://docs.google.com/View?docid=dd363fg9_77gb4hdh7b.谢谢!
我正在尝试在iPlanet LDAP上进行分页搜索.这是我的代码:
LdapConnection ldap = new LdapConnection("foo.bar.com:389");
ldap.AuthType = AuthType.Anonymous;
ldap.SessionOptions.ProtocolVersion = 3;
PageResultRequestControl prc = new PageResultRequestControl(1000);
string[] param = new string[] { "givenName" };
SearchRequest req = new SearchRequest("ou=people,dc=bar,dc=com", "(ou=MyDivision)", SearchScope.Subtree, param);
req.Controls.Add(prc);
while (true)
{
SearchResponse sr = (SearchResponse)ldap.SendRequest(req);
... snip ...
}
Run Code Online (Sandbox Code Playgroud)
当我运行它时,我得到一个异常,指出"服务器不支持控件.控件是关键的"在剪辑之前的行上.快速谷歌搜索没有任何结果.iPlanet是否支持分页?如果是这样,我做错了什么?谢谢.