Answered by:
LinqDataSource returning a large number of 'entities' that are not part of the schema I'm Selecting

Question
-
User-1360958501 posted
I'm doing a very ordinary 'SELECT * from blahblah' but in the DetailsView I'm getting fields such as
[<asp:BoundField DataField="UnobtrusiveValidationMode" HeaderText="UnobtrusiveValidationMode" SortExpression="UnobtrusiveValidationMode" />
<asp:BoundField DataField="ClientTarget" HeaderText="ClientTarget" SortExpression="ClientTarget" />
<asp:BoundField DataField="ClientQueryString" HeaderText="ClientQueryString" ReadOnly="True" SortExpression="ClientQueryString" />
<asp:BoundField DataField="ErrorPage" HeaderText="ErrorPage" SortExpression="ErrorPage" />
<asp:CheckBoxField DataField="IsCallback" HeaderText="IsCallback" ReadOnly="True" SortExpression="IsCallback" />
<asp:CheckBoxField DataField="IsReusable" HeaderText="IsReusable" ReadOnly="True" SortExpression="IsReusable" />
<asp:BoundField DataField="IdSeparator" HeaderText="IdSeparator" ReadOnly="True" SortExpression="IdSeparator" />
<asp:CheckBoxField DataField="MaintainScrollPositionOnPostBack" HeaderText="MaintainScrollPositionOnPostBack" SortExpression="MaintainScrollPositionOnPostBack" />
<asp:BoundField DataField="MasterPageFile" HeaderText="MasterPageFile" SortExpression="MasterPageFile" />
<asp:BoundField DataField="MaxPageStateFieldLength" HeaderText="MaxPageStateFieldLength" SortExpression="MaxPageStateFieldLength" />
<asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
<asp:BoundField DataField="MetaDescription" HeaderText="MetaDescription" SortExpression="MetaDescription" />
<asp:BoundField DataField="MetaKeywords" HeaderText="MetaKeywords" SortExpression="MetaKeywords" />
<asp:BoundField DataField="Theme" HeaderText="Theme" SortExpression="Theme" />
<asp:BoundField DataField="StyleSheetTheme" HeaderText="StyleSheetTheme" SortExpression="StyleSheetTheme" />
<asp:CheckBoxField DataField="IsCrossPagePostBack" HeaderText="IsCrossPagePostBack" ReadOnly="True" SortExpression="IsCrossPagePostBack" />
<asp:CheckBoxField DataField="IsPostBack" HeaderText="IsPostBack" ReadOnly="True" SortExpression="IsPostBack" />
<asp:CheckBoxField DataField="EnableEventValidation" HeaderText="EnableEventValidation" SortExpression="EnableEventValidation" />
<asp:CheckBoxField DataField="EnableViewState" HeaderText="EnableViewState" SortExpression="EnableViewState" />
<asp:BoundField DataField="ViewStateEncryptionMode" HeaderText="ViewStateEncryptionMode" SortExpression="ViewStateEncryptionMode" />
<asp:BoundField DataField="ViewStateUserKey" HeaderText="ViewStateUserKey" SortExpression="ViewStateUserKey" />
<asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID" />
<asp:BoundField DataField="ValidateRequestMode" HeaderText="ValidateRequestMode" SortExpression="ValidateRequestMode" />
<asp:CheckBoxField DataField="SkipFormActionValidation" HeaderText="SkipFormActionValidation" SortExpression="SkipFormActionValidation" />
<asp:CheckBoxField DataField="Visible" HeaderText="Visible" SortExpression="Visible" />
<asp:CheckBoxField DataField="IsPostBackEventControlRegistered" HeaderText="IsPostBackEventControlRegistered" ReadOnly="True" SortExpression="IsPostBackEventControlRegistered" />]and that's only about half of the 'fields' returned. What is going on here? This has been working fine for years. Just recently upgraded to vs2019 and SQL Express 2017
Thursday, June 6, 2019 8:03 AM
Answers
-
User-1360958501 posted
Thanks for your response. Not the answer but I have however solved my problem.
The particular table that was the issue had a multitude of Foreign key tables behind the scenes the at I think must have confounded things.
I made a copy of the table, gave it a new name, inserted it into DataContext and reedited all the associations.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Saturday, June 8, 2019 10:05 PM
All replies
-
User753101303 posted
Hi,
Looks like Page properties. Double check how the source for your DetailsView is populated. It seems you end up in using the current page instance as a data source. Check the markup. If handling errors double check what you doing in this case.
Thursday, June 6, 2019 8:34 AM -
User-1360958501 posted
Thanks for your response. Not the answer but I have however solved my problem.
The particular table that was the issue had a multitude of Foreign key tables behind the scenes the at I think must have confounded things.
I made a copy of the table, gave it a new name, inserted it into DataContext and reedited all the associations.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Saturday, June 8, 2019 10:05 PM