title: ASP.NET SelectParameter / Control Parameter usage
body: <p>newbie to asp.net here.</p>
  
  <p>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.</p>
  
  <pre><code>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)"&gt;
                          &lt;SelectParameters&gt;
                              &lt;asp:ControlParameter ControlID="TradeDate1" DefaultValue="8-10-2012" Name="T1" Type="DateTime" PropertyName="Text" /&gt;
                              &lt;asp:ControlParameter ControlID="TradeDate2" DefaultValue="8-11-2012" Name="T2" Type="DateTime" PropertyName="Text" /&gt;
                      &lt;/SelectParameters&gt;
  </code></pre>
  
  <p>TradeDate1 and TradeDate2 refer to 2 textbox controls that I setup for date picking.</p>
  
  <p>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.</p>
  
  <p>Any help would be appreciated. Thanks!</p>