未在 datagridview 中获取信息。如果我在多文本框中尝试过它很好但在 datagridview 中没有
public String Accountlocked()
{
//DirectoryEntry entry = new DirectoryEntry("LDAP://Mytechnet.com");
DirectoryEntry entry = new DirectoryEntry("LDAP://User");
DirectorySearcher Dsearch = new DirectorySearcher(entry);
Dsearch.Filter = "(&(&(&(&(&(objectCategory=person)(objectClass=user)>>(lockoutTime:1.2.840.113556.1.4.804:=4294967295))))))";
using (StringWriter sw = new StringWriter())
{
foreach (SearchResult sResultSet in Dsearch.FindAll())
{
sw.WriteLine("{0}", (GetProperty(sResultSet, "samaccountname")));
sw.WriteLine("{0}", (GetProperty(sResultSet, "name")));
}
return sw.ToString();
}
}
开启按钮
dataGridView1.DataSource = Accountlocked().ToList();