未在datagridview中獲取信息。 如果我在多文本嘗試它的罰款,但不是在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();
你確定你想轉換爲字符作爲你的GridView的數據源的列表的字符串? – rikitikitik 2013-03-08 03:28:17
'string.ToList()'返回'列表'。你期望看到什麼? –
2013-03-08 03:30:38