I have a database schema as follows:
FailureItem
---------------
FailureID int foreign key references Failure (FailureID)
DatabaseID int NULL foreign key references Items (DatabaseID)
FailureDescription varchar(200)
Item
---------------
DatabaseID int primary key identity(1,1)
ItemDescription varchar(200)
I am using linq to bind this to a gridview as follows:
Dim items as List(Of FailureItems) =
context.FailureItems.include("Item").where(function(x) x.FailureID = _failureID)
<asp:GridView ID="gv1" runat="server">
<Columns>
<asp:BoundField DataField="databaseID" Visible="false" />
<asp:BoundField DataField="FailureDescription" headertext="Failure Description" />
<asp:BoundField DataField="Item.ItemDescription" headertext="Item Description" />
</Columns>
</asp:GridView>
This works perfectly on my development machine. When I release this onto azure, I get the error “A field or property with the name ‘Item.ItemDescription’ was not found on the selected data source.” What am I doing wrong?
I ended up changing the code to the following, which worked: