Using SqlDataSource - but how do I provide it with parameters at runtime?

From the Toolbox I have selected a SqlDataSource.  It has a wizard for building the Select statement, but how do I provide parameters to this Select statement at runtime?  What does my Select statement look like and what do I need to do in the code behind?

I need detailed steps.


Tom KnowltonWeb developerAsked:
Who is Participating?
SammyConnect With a Mentor Commented:
You dont do nothing in code behind
an example of a control parameters
 <asp:ControlParameter ControlID="MyCOntrolID" Name="DataFieldName" PropertyName="Text" Type="String" />
best if you create a testpage and use the wizard to to create the parameters for you then copy them to your existing page
You can still use the same wizard to provide parameters
after the first step "Connection step" the second step the wizard will show 3 buttons Where, Order By and Advanced
if you click on the where button you will get the option to select params
Column, Operator and source
once you select the first param you have to click on Add to add it
Tom KnowltonWeb developerAuthor Commented:
And then in the code behind, what do I do?
Tom KnowltonWeb developerAuthor Commented:
The problem is I am building my own SQL Statement in the DataSource.

When I select that option....the Advanced button becomes disabled.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.