1
我試圖顯示使用WPF數據網格這可是沒有數據源像的WinForms DataGridView中我LINQ結果..WPF LINQ的結果數據網格
我一直是這樣,現在掙扎小時,只是不明白我需要做什麼。我的代碼如下:
private void BindDataGrid(string searchString) //passed on button click
{
DatabaseEntities entity = new DatabaseEntities();
var postcodes = (from p in entity.postcode_table
where p.postcode.Equals(searchString)
orderby p.postcode ascending
select p);
dataGrid.ItemsSource = postcodes;
}
這裏的任何幫助將是偉大的。這不是我每天做的事情,所以請耐心等待。
謝謝
你對你的代碼有任何問題嗎?你能否更好地解釋你需要做什麼? – ASh
我的代碼沒有問題。我用文本框和按鈕創建了一個wpf表單。當輸入郵編並單擊按鈕時,我需要從數據庫中檢索輸入的郵編的詳細信息。 – Pete