[英]SqlDataSource Syntax
The questions seems to be easy but unfortunately the command I'm using here is not working for me. 问题似乎很简单,但不幸的是我在这里使用的命令对我不起作用。
I'm having this command line inside my webform 我的网络表单中有此命令行
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$
ConnectionStrings:dmax0913_4Sem_18ConnectionString %>"
ProviderName="System.Data.SqlClient"
SelectCommand="SELECT [Strength], [Intelligence], [Charm], [Talent] FROM [Male]
WHERE [Male.ID] = [User.ID]">
</asp:SqlDataSource>
Basically I want to display in a gridview the "Strenght" , "Intelligence" , "Charm" and "Talent" which are stored in a table named "Male" where the ID of the table is equal to the ID of another table named User. 基本上我想在网格视图中显示存储在名为“ Male”的表中的“ Strenght”,“ Intelligence”,“ Charm”和“ Talent”,其中该表的ID等于另一个名为User的表的ID 。
You need Inner Join
here:- 您需要在这里
Inner Join
:
SelectCommand ="SELECT [Strength], [Intelligence], [Charm], [Talent] FROM [Male]
INNER JOIN [User] ON [Male.ID] = [User.ID]"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.