以下内部联接查询会出错。
QUERY:
select resultId,Analysed.bugId as BugDet,bugType
from Analysed
INNER JOIN Bug on Analysed.bugId=Bug.bugId where Analysed.runId=118
SCHEMA:
[分析表] - (runId,resultId,bugId)
[错误表] - (bugId,bugType)
错误:
在所选数据源上找不到名为“BugDet”的字段或属性。
实际上,我在gridView中使用它。
代码
<asp:
SqlDataSource ProviderName="System.Data.SqlClient"
ID = "SqlDataSource1" runat = "server"
ConnectionString = "Data Source=(localdb)\v11.0;Initial Catalog=Dash;Integrated Security=SSPI" SelectCommand = "select resultId,Analysed.bugId as BugDet,bugType from Analysed INNER JOIN Bug on Analysed.bugId=Bug.bugId where Analysed.runId=118"
/>
<asp:
GridView ID = "GridView1"
runat = "server"
DataSourceID = "sourceProducts"
AutoGenerateColumns = "False"
CssClass="table-hover table push"
AllowPaging="true"
AllowSorting="true"
PageSize="5"
>
<Columns>
<asp:BoundField DataField = "resultId" HeaderText = "ResulId" />
<asp:BoundField DataField = "BugDet" HeaderText = "BugId" />
<asp:BoundField DataField="bugType" HeaderText="BugType" />
</Columns>
答案 0 :(得分:0)
我发现了错误。感谢所有试图提供帮助的人。 网格视图的dataSourceId与sql提供程序的id不匹配。