aspx 页面错误传递存储过程(sql) ASP.NET (C#)

aspx page error passing stored procedure(sql) ASP.NET (C#)

我是 asp 编程新手。我在此页面中使用了直接 SQL 命令并且程序是 运行 正确但是当我将命令更改为存储过程并按如下方式定义它们时,出现如下所述的错误。

ASPX 标记:

    <asp:SqlDataSource ID="SqlDataSourceTech" runat="server" 
        ConnectionString="<%$ ConnectionStrings:constr %>" 
        SelectCommand="usp_get_technical_data"
        UpdateCommand="usp_update_technical_data" 
        SelectCommandType = "StoredProcedure" 
        UpdateCommandType ="StoredProcedure">

        <SelectParameters>
        <asp:ControlParameter ControlID="LblTowerNo" Name="tower" PropertyName = "Text" Type = "String"/>
           </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="type" Type="String" />
            <asp:Parameter Name="extension" Type="String" />
            <asp:Parameter Name="insulator" Type="String" />
            <asp:Parameter Name="aviation_lamp" Type="String" />
            <asp:Parameter Name="pilot" Type="String" />
            <asp:Parameter Name="t_start" Type="DateTime" />
            <asp:Parameter Name="t_complete" Type="DateTime" />
            <asp:Parameter Name="tower" Type="String" />
        </UpdateParameters>
    </asp:SqlDataSource>

错误:

Server Error in '/' Application.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: The server tag is not well formed.

Source Error:

Line 142: asp:SqlDataSource ID="SqlDataSourceSpan" runat="server"

检查行:

ConnectionString="<%$ ConnectionStrings:constr %>" 

如果 ConnectionString 里面有双引号,请尝试对参数使用单引号,例如:

ConnectionString='<%$ ConnectionStrings:constr %>'

最终再次仔细检查 post 代码周围的 before/after 代码。