Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to debug SQLDataSource update command?
    text
    copied!<p>In Visual Studio 2010 is there a way to step through the Update Command of a SQLDataSource?</p> <p>I have the SQLDataSource and the parameters specified on the *.aspx It's using a Stored Procedure.</p> <p>I'm getting a "has too many arguments specified" error. The number of parameters I've specified exactly match the stored proc. So, I'd love to be able to debug and see what arguments the SQLDataSource is trying to send.</p> <p>My stored procedure:</p> <pre><code>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 </code></pre> <p>My SQLDataSource:</p> <pre><code>&lt;asp:SqlDataSource ID="ds1" runat="server" ... UpdateCommand="UPDATE_TABLEA" UpdateCommandType="StoredProcedure" ... &gt; &lt;UpdateParameters&gt; &lt;asp:Parameter Type="Int32" Name="@ID" Direction="Input" /&gt; &lt;asp:Parameter Type="String" Size="200" Name="@COL1" Direction="Input" /&gt; &lt;asp:Parameter Type="String" Size="200" Name="@COL2" Direction="Input" /&gt; &lt;asp:Parameter Type="String" Size="20" Name="@COL3" Direction="Input" /&gt; &lt;asp:Parameter Type="String" Size="100" Name="@COL4" Direction="Input" /&gt; &lt;asp:Parameter Type="String" Size="100" Name="@COL5" Direction="Input" /&gt; &lt;asp:Parameter Type="String" Size="10" Name="@COL6" Direction="Input" /&gt; &lt;asp:Parameter Type="String" Size="200" Name="@COL7" Direction="Input" /&gt; &lt;asp:Parameter Type="DateTime" Name="@COL8" Direction="Input" /&gt; &lt;asp:Parameter Type="DateTime" Name="@COL9" Direction="Input" /&gt; &lt;asp:Parameter Type="String" Size="20" Name="@COL10" Direction="Input" /&gt; &lt;asp:Parameter Type="DateTime" Name="@COL11" Direction="Input" /&gt; &lt;asp:Parameter Type="String" Size="20" Name="@COL12" Direction="Input" /&gt; &lt;asp:Parameter Type="DateTime" Name="@COL13" Direction="Input" /&gt; &lt;asp:Parameter Type="String" Size="100" Name="@COL14" DefaultValue="&lt;%=user_id%&gt;" Direction="Input" /&gt; &lt;/UpdateParameters&gt; </code></pre> <p>Here's the SQL Profiler Output:</p> <pre><code>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'&lt;%=user_id%&gt;',@ID=1 </code></pre> <p>The last 2 params look odd. Not sure why though...</p> <p>Any ideas...why it's telling me too many arguments?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload