作为使用SqlDataSource的申报性辛醇的新产品,我试图为储存程序确定参数的价值。 我有一个客户——通过请求目标传递的ID,我需要确定客户—— 在SqlDataSource储存程序之前的身份证已经执行。
我有两个问题。
储存程序参数是否必须在业余标记中预先界定,或者是否可在编码背后动态添加?
是否有任何实例显示SqlDataSource在储存程序和参数上的标记,以及在编码背后确定该参数的价值?
作为使用SqlDataSource的申报性辛醇的新产品,我试图为储存程序确定参数的价值。 我有一个客户——通过请求目标传递的ID,我需要确定客户—— 在SqlDataSource储存程序之前的身份证已经执行。
我有两个问题。
储存程序参数是否必须在业余标记中预先界定,或者是否可在编码背后动态添加?
是否有任何实例显示SqlDataSource在储存程序和参数上的标记,以及在编码背后确定该参数的价值?
有了网4,你可以......
1.It can be added dynamically, but you would have to provide your own code expression builder (for further info see here) 1.1 You can also use different parameter to achieve same goal, like :
2. 结 论
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:yourConnectionString %>"
SelectCommand="YourStoreProcedure" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter Name="yourParameterName" ControlID="controlThatHoldsParameterValue" PropertyName="Text" />
</SelectParameters>
这是使用SqlDataSource(包括方案设定参数)的参数查询(保存程序和文本)的一个相当彻底的例子。 ASP.NET——使用SqlDataSource的参数。
<asp:SqlDataSource ID="ADSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ADConnection %>"
SelectCommand="GetProfile" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="InputTextBox" Name="Host" PropertyName="Text" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
GetProfile is the stored proc name and Host is parameter name, which is retreived from a texbox called InputTextBox
In my webpages I have references to js and images as such: "../../Content/Images/"Filename" In my code if I reference a file as above, it doesnt work so i have to write: "c:/miscfiles/"filename" 1-...
I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...
Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...
I m looking for best practices here. Sorry. I know it s subjective, but there are a lot of smart people here, so there ought to be some "very good" ways of doing this. I have a custom object called ...
I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...
i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...
For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?
I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!