我正在尝试使用绑定属性<%#Bind%>但是我加入了很多表,因为点,我无法使用名称为c.FormID的列。调试时,只能将其视为" c"。
有没有办法解决这个问题?
我的代码:
SelectedValue='<%# Bind("c.FormID") %>'
继承我的sql代码:
SELECT c.FormID, FormSectionSubSectionItemRelID,c.ControlTypeID,c.FormSectionID,c.SubSectionID,c.SectionItemID,c.ValidationRulesetId,c.CrossItemID, FormTitle, FormSection ,SubSection, SectionItem, SortOrder, SectionSortOrder,SubSectionSortOrder, RulesetDesc,ControlType, CrossItem FROM Core. Form_Section_SubSection_Item_Rel c
FULL OUTER JOIN Core.FormSection_Lkup l
ON c.FormSectionID = l.FormSectionID FULL OUTER JOIN Core.FormSubSection_Lkup s
ON c.SubSectionID = s.SubSectionID FULL OUTER JOIN Core.SectionItem_Lkup i
ON c.SectionItemID = i.SectionItemID FULL OUTER JOIN Core.Form_Lkup f
ON c.FormID = f.FormID FULL OUTER JOIN Core.ValidationRuleset v
ON c.ValidationRulesetId = v.ValidationRulesetId FULL OUTER JOIN Core.ControlType_Lkup t
ON c.ControlTypeID = t.ControlTypeID FULL OUTER JOIN Core.CrossItem_Lkup g
ON c.CrossItemID = g.CrossItemID WHERE [DataCollectionPeriodID] = 74 ORDER BY FormTitle,FormSection
答案 0 :(得分:1)
您必须在select语句中为c.FormID
提供FormID
的别名,并在绑定中使用别名。更改以下声明
SELECT c.FormID, FormSectionSubSectionItemRelID, ...
到
SELECT c.FormID as FormID, FormSectionSubSectionItemRelID, ....
然后在绑定中引用FormID
SelectedValue='<%# Bind("FormID") %>'
答案 1 :(得分:0)
列的名称是FormID,c.FormID只是告诉语句使用表c,而不是实际命名列&#34; c.FormID&#34;