Parameterize From Statement in SqlDataSource C# asp.net -
i trying parameterize statement of asp:sqldatasource select command. current command hard coded:
<asp:sqldatasource id="sdssps" runat="server" connectionstring="<%$ connectionstrings:aaps_devconnectionstring %>" selectcommand="select specific_name win_dev.information_schema.routines routine_type = 'procedure'"> </asp:sqldatasource>
however looking more this:
<asp:sqldatasource id="sdssps" runat="server" connectionstring="<%$ connectionstrings:aaps_devconnectionstring %>" selectcommand="select specific_name @path routine_type = 'procedure'"> <selectparameters> <asp:controlparameter controlid="lbldb" propertyname="text" name="path" type="string" /> </selectparameters> </asp:sqldatasource>
or more preferable this:
<asp:sqldatasource id="sdssps" runat="server" connectionstring="<%$ connectionstrings:aaps_devconnectionstring %>" selectcommand="select specific_name @path.information_schema.routines routine_type = 'procedure'"> <selectparameters> <asp:controlparameter controlid="lbldb" propertyname="text" name="path" type="string" /> </selectparameters> </asp:sqldatasource>
all of these trys have come failing. there no way me know ahead of time db user can select it. there way this? , if it? help!
you may have write dynamic query/procedure requirement,
create proc get_from_dynamic_table @tablename varchar(50) begin declare @sqlquery nvarchar(100) set @sqlquery = 'select * '+@tablename exec sp_executesql @sqlquery end
note: code not tested.
c# asp.net
No comments:
Post a Comment