我有一个数据列表,并且正在为“领导”表使用左外连接,我试图在其中获得“职位”。但我收到错误消息,“DataBinding:'System.Data.DataRowView' 不包含名为 'Position' 的属性。”
CustomerTable LeadershipTable
CustomerId Name, LeadershipPosition Id Position
1 Bob 1 1 President
2 Greg 2 2 vice-President
3 Polly 4 3 Secratary
4 Anna 3 4 Treasurer
<asp:DataList ID="DataList1" RepeatColumns="2" DataKeyField="CustomerId" runat="server" DataSourceID="SqlDataSource2">
以及从代码隐藏填充的 sqldatasource:
SqlDataSource2.SelectCommand = "SELECT Customer.CustomerId, Customer.FName + ' ' + Customer.LName As Name, Customer.Address1, Customer.City, Customer.State, Customer.Zip, Customer.Cell, Customer.Email, Customer.profilePic, Customer.LeadershipPosition From Customer LEFT OUTER JOIN Leadership ON Customer.LeadershipPosition = Leadership.Id WHERE Customer.CommitteeId = '1'"
SqlDataSource2.DataBind()