[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 210
  • Last Modified:

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.

Thanks!

Tom
0
Tom Knowlton
Asked:
Tom Knowlton
  • 2
  • 2
1 Solution
 
Sammy AgeilCommented:
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
0
 
Tom KnowltonWeb developerAuthor Commented:
And then in the code behind, what do I do?
0
 
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.
0
 
Sammy AgeilCommented:
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
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now