我正在使用这样的 SQL 数据源:
<asp:sqldatasource id="sds_sale" runat="server" connectionstring="<%$ ConnectionStrings:TestServerConnection %>"
InsertCommand="INSERT INTO Sale (transactionID, salePrice) VALUES (@transactionID,@salePrice) SET @Identity = SCOPE_IDENTITY()">
<InsertParameters>
<asp:Parameter Name="transactionID" />
<asp:Parameter Name="salePrice" />
</InsertParameters>
</asp:sqldatasource>
插入 SQL 语句:
INSERT INTO Sale (transactionID, salePrice)
VALUES (@transactionID,@salePrice)
SET @Identity = SCOPE_IDENTITY()
我想返回范围标识,但查询生成器说它无法解析 SQL 语句。我究竟做错了什么?