Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8418851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:26:30+00:00 2026-06-10T02:26:30+00:00

newbie to asp.net here. I am trying to setup a selectparameters and controlparameters based

  • 0

newbie to asp.net here.

I am trying to setup a selectparameters and controlparameters based off textbox web controls for date ranges to retrieve data on a asp.net page.

SelectCommand="SELECT SUM(Turnover) AS TotalTurnover, (SUM(Turnover) / (SELECT COUNT(*) FROM (SELECT DISTINCT [Trade Date] FROM TradeSummary WHERE ([Trade Date] BETWEEN @T1 AND @T2)))) AS AverageTO FROM TradeSummary WHERE ([Trade Date] BETWEEN @T1 AND @T2)">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="TradeDate1" DefaultValue="8-10-2012" Name="T1" Type="DateTime" PropertyName="Text" />
                            <asp:ControlParameter ControlID="TradeDate2" DefaultValue="8-11-2012" Name="T2" Type="DateTime" PropertyName="Text" />
                    </SelectParameters>

TradeDate1 and TradeDate2 refer to 2 textbox controls that I setup for date picking.

I am wondering how I can examine the values of @T1 and @T2 so that I can ensure the query being passed to the DB is valid because it seems like if I were to eval(“TotalTurnover”) then I get a dbnull error.

Any help would be appreciated. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T02:26:32+00:00Added an answer on June 10, 2026 at 2:26 am

    you can also pass the control paraamters from your code behind after checking the values. Add the below code in your Page_Load or any other control event ( e.g button )

    // check your textbox values
    if( TradeDate1.Text != null )
    {
       SqlDataSource1.SelectParameters.Add("@T1",TradeDate1.Text);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Newbie question: There are three types of Asp.Net controls : HTML server controls, Web
AJAX newbie here! At the moment in my ASP.NET MVC web app my AJAX
Newbie here, I havn't done much membership stuff for asp.net. I am trying to
ASP.NET newbie here I have coded up an ASP.NET website and running on win'08
ASP.NET newbie here. When on a page I'd like to set the corresponding menu
I'm a newbie with ASP.NET web applications. When I create an ASP.NET web app
I am a newbie to ASP.NET MVC (v2), and I am trying to use
I'm a newbie to asp .net and c# world. I'm trying to insert a
I'm a newbie in ASP.net MVC 3. I'm trying to do something trivial, but
ASP.NET newbie here. I would like to create a form with multiple types of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.