我有两张表,Publication 和 DTPersonnel。发布有一个主键,另一个(DTPersonnel)有一个链接回发布的字段。我为我的 LinqDataSource 发送了一个 DBML 布局并链接了两个表。我已将 LinqDataSource 组件添加到我的网页和(用于测试)一个标签。
然后我将标签数据绑定设置为指向 DTPersonnel.DTRoleID 中的一个字段,如下所示:
<asp:FormView ID="FormView1" runat="server" AllowPaging="True"
DataSourceID="LinqDataSource1">
<ItemTemplate>
<asp:Label ID="Label1" runat="server"
Text='<%# BIND("DTPersonnels.DTRoleID") %>'></asp:Label>
</ItemTemplate>
</asp:FormView>
</asp:Content>
我的 LinqDataSource 设置如下:
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Layout.aspx.cs" Inherits="AequorPubTracker.Account.Layout" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:LinqDataSource ID="LinqDataSource1" runat="server"
ContextTypeName="AequorPubTracker.LayoutDataContext" EntityTypeName=""
onselecting="LinqDataSource1_Selecting" TableName="Publications"
Select="new (DTPersonnels.DTRoleID,PublicationID, DTPersonnels, ActLAYDate, ActRRIPDate, ActPPIDate, ActPPODate, ActECTWDate, TargetECTWDate, TargetPPIDate, TargetRRIPDate, TargetPPODate, TargetLAYDate)">
</asp:LinqDataSource>
但是当我在浏览器中运行该应用程序时,出现以下错误:
异常详细信息:System.Web.Query.Dynamic.ParseException:“EntitySet`1”类型中不存在属性或字段“DTRoleID”
我希望我提供了足够的信息,任何帮助都会很棒。