mysql - MySql Server Inner join 查询中的无效对象名称错误

标签 mysql asp.net gridview

下面的内连接查询给出了错误。

查询:

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/

相关文章:

python - 每秒低 InnoDB 写入 - 使用 Python 的 AWS EC2 到 MySQL RDS

php - 如何在 1-n 之间选择 RAND()

php - 多关系 Laravel 5

asp.net - 在Asp.Net中,在重定向到aspx页面之前检查它是否存在?

c# - 如何控制gridview中的列宽?

mysql - (async) 使用 sequelize 和 node 在 mysql 数据库中创建多个寄存器

c# - ASP.NET Web API 性能问题

c# - ObjectQuery 和 "var"有什么区别?

asp.net - 如何从 gridbox 中检索更新的数据并在数据库中更新它

c# - 以编程方式将数据插入word文件并保存在asp.net中