asp.net - How to specify parameter value for stored procedure in SqlDataSource -


Due to being new to using the declarative syntax of SqlDataSource, I want to extract a way to set the value of a parameter Attempted collection process. I have a client_id that has been passed through the request object and I need to set up Client_ID before executing the stored procedure of SqlDataSource.

I have some questions.

  1. Does the stored operating parameter have to be predefined in ASPX markup or it can be dynamically linked to the code-back?

  2. Would anyone have an example SqlDataSource markup as a stored procedure and parameter as well as code-back in that parameter value setting?

    With the .NET 4 framework you can ...

    1.It can be dynamically added, but you have to provide your own code expression builder (for more information) 1.1 You can also use different parameters to achieve the same goal , Such as:

    Enter image details here

    2.

      & lt; Asp: SqlDataSource id = "SqlDataSource1" runat = "server" connection string = "& lt;% $ connectionrestrictions: yourConnectionString%>" SelectCommand = "YourStoreProcedure" SelectCommandType = "stored Process" & gt; & Lt; SelectParameters & gt; & Lt; Asp: ControlParameter name = "yourParameterName" ControlID = "controlThatHoldsParameterValue" property name = "text" /> & Lt; / SelectParameters & gt;   



Comments