在 Visual Studio 2010 中,有没有办法逐步执行 SQLDataSource 的更新命令?
我有 SQLDataSource 和 *.aspx 上指定的参数它使用存储过程。
我收到“指定的参数太多”错误。我指定的参数数量与存储过程完全匹配。因此,我希望能够调试并查看 SQLDataSource 尝试发送的参数。
我的存储过程:
ALTER PROCEDURE [dbo].[UPDATE_TABLEA]
--UPDATE
@ID int,
@COL1 varchar(200),
@COL2 varchar(200),
@COL3 varchar(20),
@COL4 varchar(100),
@COL5 varchar(100),
@COL6 varchar(10),
@COL7 varchar(200),
@COL8 datetime,
@COL9 datetime,
@COL10 varchar(20),
@COL11 datetime,
@COL12 varchar(20),
@COL13 datetime,
--INSERT TRANSACTION
@COL14 varchar(100)
AS
BEGIN
--UPDATE
UPDATE TABLEA SET
COL1 = @COL1,
COL2 = @COL2,
COL3 = @COL3,
COL4 = @COL4,
COL5 = @COL5,
COL6 = @COL6,
COL7 = @COL7,
COL8 = @COL8,
COL9 = @COL9,
COL10 = @COL10,
COL11 = @COL11,
COL12 = @COL12,
COL13 = @COL13,
COL15 = (SELECT COLX FROM TABLE WHERE [COLY] = 'ASDF')
WHERE ID = @ID
--ADD TRANSACTION
INSERT INTO TABLEB ([COL1], [COL2], id, [datetime]) VALUES (@COL14, (SELECT COLX FROM TABLE WHERE [COLY] = 'ASDF'), @ID, GETDATE())
END
我的 SQL 数据源:
<asp:SqlDataSource ID="ds1" runat="server"
...
UpdateCommand="UPDATE_TABLEA" UpdateCommandType="StoredProcedure"
...
>
<UpdateParameters>
<asp:Parameter Type="Int32" Name="@ID" Direction="Input" />
<asp:Parameter Type="String" Size="200" Name="@COL1" Direction="Input" />
<asp:Parameter Type="String" Size="200" Name="@COL2" Direction="Input" />
<asp:Parameter Type="String" Size="20" Name="@COL3" Direction="Input" />
<asp:Parameter Type="String" Size="100" Name="@COL4" Direction="Input" />
<asp:Parameter Type="String" Size="100" Name="@COL5" Direction="Input" />
<asp:Parameter Type="String" Size="10" Name="@COL6" Direction="Input" />
<asp:Parameter Type="String" Size="200" Name="@COL7" Direction="Input" />
<asp:Parameter Type="DateTime" Name="@COL8" Direction="Input" />
<asp:Parameter Type="DateTime" Name="@COL9" Direction="Input" />
<asp:Parameter Type="String" Size="20" Name="@COL10" Direction="Input" />
<asp:Parameter Type="DateTime" Name="@COL11" Direction="Input" />
<asp:Parameter Type="String" Size="20" Name="@COL12" Direction="Input" />
<asp:Parameter Type="DateTime" Name="@COL13" Direction="Input" />
<asp:Parameter Type="String" Size="100" Name="@COL14" DefaultValue="<%=user_id%>" Direction="Input" />
</UpdateParameters>
这是 SQL 探查器输出:
exec UPDATE_TABLEA @@ID=NULL,@@COL1=NULL,@@COL2=NULL,@@COL3=NULL,@@COL4=NULL,@@COL5=NULL,@@COL6=NULL,@@COL7=NULL,@@COL8=NULL,@@COL9=NULL,@@COL10=NULL,@@COL11=NULL,@@COL12=NULL,@@COL13=NULL,@@COL14=N'<%=user_id%>',@ID=1
最后 2 个参数看起来很奇怪。虽然不知道为什么...
任何想法......为什么它告诉我太多的论点?