c# - Catch a query string with parameter values from a SqlDataSource in ASP.net applications -
in asp.net application have sqldatasource
parameters e. g.:
<asp:sqldatasource id="sqldatasource1" runat="server" connectionstring="..." onselecting="sqldatasource1_selecting" providername="system.data.sqlclient" selectcommand="select * [sometable] ([sometableid] = @sometableid)"> <selectparameters> <asp:controlparameter controlid="dropdownlist1" name="sometableid" propertyname="selectedvalue" type="int32" /> </selectparameters> </asp:sqldatasource>
for debugging purposes helpful somehow catch query string executed on database server i. e. query string filled in parameter values.
i tried in sqldatasource1_selecting
event, sqldatasourceselectingeventargs
arguments still contain selectcommand
text above: select * [sometable] ([sometableid] = @sometableid)
.
how can true query string @valiables replaced values used selection?
there no way view in code. sqlcommand class calls sp_execute separates query parameters. you'll need use sql profiler see exact query executed.
you can learn how use sqlprofiler through this.
Comments
Post a Comment