简体   繁体   中英

Find SQL parameters passed with C# without SQL Server Profiler

I am binding a telerik grid with the SqlDataSource of type stored proc. I also have some parameters added in the SqlDataSource .

Now I would like to know what are the final values that were being passed to the stored procedure on the server. I don't have the permissions to use SQL Server profiler.

<asp:SqlDataSource ID="sqlSource" runat="server" SelectCommand="dbo.sp_abc" SelectCommandType="StoredProcedure">
    <SelectParameters>
        <asp:Parameter Name="pUserID" Type="Int32" DefaultValue="0" />
        <asp:Parameter Name="pMasterUserID" Type="Int32" DefaultValue="0" />
        <asp:Parameter Name="pDBID" Type="Int32" DefaultValue="0" />
        <asp:ControlParameter Name="pIncludeHistoric" Type="Boolean" DefaultValue="False" 
            ControlID="chkCurrentOnly" PropertyName="Checked" />        
    </SelectParameters>
</asp:SqlDataSource> 

Is there any way best way to find the values sent to the database at the application server side?

you should bind your data to your grid manually and not use a SQLDataSource. This would allow you to "see" the values of the parameters sent to the grid.

The only way i see this possible is to run your application on a local mssql server, or any other mssql server where you do have permission. this will allow you you to profile.

You can copy the database with mssms without having to have root privileges by using the the SQL Management Object method , this might take some time if your database is very large.

Look at this link for more info on how to copy a database across servers.

http://msdn.microsoft.com/en-us/library/ms188664.aspx#Copy_Move

Check out MiniProfiler

It will show you how long certain methods took to execute, which SQL code was run and the parameters/values that was passed. I've only used this with MVC but this should work with WebForms too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM