0
我正在創建一個WCF服務,並且已經創建了一個從數據庫中獲取一列值的方法。方法是使用linq填充GridView與數據庫中的列表c#使用linq
public List<String> AllFriends(string username)
{
MyDatabaseEntities acontext = new MyDatabaseEntities();
var result = from c in acontext.Friends
where c.Owner==username
select c.Friend1;
return result.ToList();
}
我呼籲客戶端此方法爲:
List<string> friends = new List<string>();
friends = aSave.AllFriends(Session.username).ToList();
dataGridView2.DataSource = friends;
問題是,當我運行這個它不填充網格值,但它向我展示價值的lenght像
length
2
4
當我在列表框或組合框上調用相同的方法,然後它的工作正常,並顯示我正確的字符串,但在網格顯示字符串的長度。 請幫我解決這個問題。
哪裏是你的XAML? – 2013-04-11 16:04:26
我認爲這是winforms ... – 2kay 2013-04-11 16:05:14