3
我創建了兩個項目.NET解決方案:如何在Visual Basic中使用LINQ to Entities?
ToyData(Visual Basic中類庫)
豐根(Visual Basic中WPF應用程序)
的ToyData項目包含Toy.edmx,一個ADO.NET實體數據模型,由一個名爲Toy的數據庫生成。
的豐根項目包含此Window1.xaml.vb文件:
1 Imports ToyData 2 3 Class Window1 4 5 Private Sub Window1_Loaded(_ 6 ByVal sender As System.Object, _ 7 ByVal e As System.Windows.RoutedEventArgs) _ 8 Handles MyBase.Loaded 9 10 Dim dc As New ToyEntities 11 Label1.Content = (From c As Client In dc.ClientSet _ 12 Select c).First 13 14 End Sub 15 16 End Class
它全中,自動生成Toy.Designer.vb這個運行時異常文件:
The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.
我在做什麼錯了?
我向ToyOne項目添加了一個新的應用程序配置文件,並將它粘貼到ToyData的app.config文件的部分。有效。 –
2008-11-04 15:52:36