我正在编写以下代码来更新和删除SQL Server。 我收到以下错误消息:
'nvarchar'附近的语法不正确。
必须声明标量变量“@ID”。描述:执行当前Web请求期间发生了未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。
异常详细信息:System.Data.SqlClient.SqlException:'nvarchar'附近的语法不正确。
必须声明标量变量“@ID”。“。
代码:
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:XXX %>"
SelectCommand="SELECT * FROM [Statutory_JEs]"
UpdateCommand="UPDATE [Statutory_JEs] SET [GL Account] = @GLAccount, [IFRS S-Section] = @IFRSSSection, [Trading Partner] = @TradingPartner, [Debit] = @Debit, [Credit] = @Credit, [Description] = @Description, [JE Type] = @JEType, [Reversal next year] = @ReversalNextYear,[Impact on revenue] = @ImpactOnRevenue, [Year] = @Year, [Company Code] = @CompanyCode, [Amount] = @Amount, [Functional Area] = @FunctionalArea, [JE purpose] = @JEPurpose, [Cycle] = @Cycle WHERE [ID] = @ID"
DeleteCommand="DELETE FROM [Statutory_JEs] WHERE [ID] = @ID">
<UpdateParameters>
<asp:Parameter Name="ID" Type="Int32" />
<asp:Parameter Name="GLAccount" Type="Int32" />
<asp:Parameter Name="IFRSSSection" Type="String" />
<asp:Parameter Name="TradingPartner" Type="Int32" />
<asp:Parameter Name="Debit" Type="Int32" />
<asp:Parameter Name="Credit" Type="Int32" />
<asp:Parameter Name="Description" Type="String" />
<asp:Parameter Name="JEType" Type="String" />
<asp:Parameter Name="ReversalNextYear" Type="String" />
<asp:Parameter Name="ImpactOnRevenue" Type="String" />
<asp:Parameter Name="CompanyCode" Type="Int32" />
<asp:Parameter Name="Amount" Type="Int32" />
<asp:Parameter Name="FunctionalArea" Type="String" />
<asp:Parameter Name="JEPurpose" Type="String" />
<asp:Parameter Name="Cycle" Type="String" />
<asp:Parameter Name="Year" Type="Int32" />
</UpdateParameters>
<DeleteParameters>
<asp:Parameter Name="ID" Type="Int32" />
</DeleteParameters>
</asp:SqlDataSource>
导致错误消息的原因是什么?
提前致谢!