下面的内连接查询给出了错误。
查询:
select resultId,Analysed.bugId as BugDet,bugType
from Analysed
INNER JOIN Bug on Analysed.bugId=Bug.bugId where Analysed.runId=118
架构:
[Analysed table]-(runId,resultId,bugId)
[Bug Table]-(bugId,bugType)
错误:
A field or property with the name 'BugDet' was not found on the selected data source.
实际上,我在 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>
最佳答案
我发现了错误。感谢所有试图提供帮助的人。 GridView 的 dataSourceId 与 sql 提供程序的 id 不匹配。
关于mysql - MySql Server Inner join 查询中的无效对象名称错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28336925/