Я хочу иметь сетку, которая содержит Members.firstName
, Members.LastName
, Team.TeamName
.Team.TeamName
должно быть выпадающим списком, содержащим возможные имена TeamName.
Мои таблицы:
Members
--------
MemberID BIGINT
FirstName NVARCHAR(50)
LastName NVARCHAR(50)
TeamID BIGINT
Team
---------
TeamID BIGINT
TeamName NVARCHAR(50)
Мой выбор:
SELECT Members.FirstName, Members.LastName, Team.TeamName
FROM Members
INNER JOIN Team ON Members.TeamId = Team.TeamId
Мое обновление:
CREATE PROCEDURE updateTeamMembers
(
@TeamId BIGINT,
@FirstName NVARCHAR(50),
@LastName NVARCHAR(50),
@TeamName NVARCHAR(50)
)
AS
BEGIN
UPDATE Members SET FirstName=@FirstName, LastName=@LastName WHERE TeamId=@TeamId
UPDATE Team SET TeamName=@TeamName WHERE TeamId=@TeamId
END
RETURN
Я считаю, что ошибка связана спроцедура обновления, я получаю эту ошибку:
В процедуре или функции updateTeamMembers указано слишком много аргументов.
Мой HTML5:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:RegistrationConnectionString %>" DeleteCommand="DELETE FROM [Members] WHERE [MemberId] = @original_MemberId AND (([FirstName] = @original_FirstName) OR ([FirstName] IS NULL AND @original_FirstName IS NULL)) AND (([LastName] = @original_LastName) OR ([LastName] IS NULL AND @original_LastName IS NULL)) AND (([TeamId] = @original_TeamId) OR ([TeamId] IS NULL AND @original_TeamId IS NULL))" InsertCommand="INSERT INTO [Members] ([FirstName], [LastName], [TeamId]) VALUES (@FirstName, @LastName, @TeamId)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT Members.FirstName, Members.LastName, Team.TeamName FROM Members INNER JOIN Team ON Members.TeamId = Team.TeamId" UpdateCommand="updateTeamMembers" UpdateCommandType="StoredProcedure">
<DeleteParameters>
<asp:Parameter Name="original_MemberId" Type="Int32" />
<asp:Parameter Name="original_FirstName" Type="String" />
<asp:Parameter Name="original_LastName" Type="String" />
<asp:Parameter Name="original_TeamId" Type="Int64" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="FirstName" Type="String" />
<asp:Parameter Name="LastName" Type="String" />
<asp:Parameter Name="TeamId" Type="Int64" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="TeamId" Type="Int64" />
<asp:Parameter Name="FirstName" Type="String" />
<asp:Parameter Name="LastName" Type="String" />
<asp:Parameter Name="TeamName" Type="String" />
</UpdateParameters>
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" DataSourceID="SqlDataSource1" Height="217px" Width="596px">
<Columns>
<asp:BoundField DataField="FirstName" HeaderText="First Name" SortExpression="FirstName" />
<asp:BoundField DataField="LastName" HeaderText="Last Name" SortExpression="LastName" />
<asp:BoundField DataField="TeamName" HeaderText="Team Name" SortExpression="TeamName" />
<asp:CommandField ShowEditButton="True" />
</Columns>
Команда обновлениякогда я настраиваю через источник данных (не обновляется):
UPDATE [Members] SET [FirstName] = @FirstName, [LastName] = @LastName, [TeamId] = @TeamId WHERE [MemberId] = @original_MemberId AND (([FirstName] = @original_FirstName) OR ([FirstName] IS NULL AND @original_FirstName IS NULL)) AND (([LastName] = @original_LastName) OR ([LastName] IS NULL AND @original_LastName IS NULL)) AND (([TeamId] = @original_TeamId) OR ([TeamId] IS NULL AND @original_TeamId IS NULL))