gridview删除选项中的语法错误

时间:2014-05-28 13:06:38

标签: html asp.net gridview

我在网格视图中添加了删除操作,但语法错误我不明白 这是我的代码:

DeleteCommand = "DELETE FROM [Games] 
                 WHERE [Team1] = @Team1, [Team2] = @Team2"

InsertCommand = "INSERT INTO [Games] ([Team1], [Team2], [GameType], [Time]) VALUES (@Team1, @Team2, @GameType, @Time)"

UpdateCommand = "UPDATE [Games] SET [Team1] = @Team1, [Team2] = @Team2, [GameType] = @GameType, [Time] = @Time WHERE [Team1] = @Team1">

<DeleteParameters>
    <asp:Parameter Name="Team1" Type="string" />
    <asp:Parameter Name="Team2" Type="string" />
    <asp:Parameter Name="GameType" Type="string" />
</DeleteParameters>

谢谢

1 个答案:

答案 0 :(得分:0)

DELETE FROM [Games] WHERE [Team1] = @Team1,[Team2]=@Team2

应该是

DELETE FROM [Games] WHERE [Team1] = @Team1 AND [Team2]=@Team2

注意&#34;和&#34;条件之间。

仅供参考 - 将来发布错误消息将阻止您获得投票但无论如何......