title: Retrieving data from MS Access database using timestamps i.e. starting and ending date on a user form
body: <p><em>I had a question about retrieving data from MS Access database using timestamps i.e. starting and ending date on a user form. Kindly let me know if and what's the process to do that. I'm using Microsoft Visual Studio 2015. Website user interface will be in Asp.net with VB. Although I have tried passing parameters I am not understanding why it is not reflecting on the Grid View</em></p>
  
  <p><strong>ASPX.VB Code</strong></p>
  
  <pre><code>Partial Class _Default
  
  Inherits System.Web.UI.Page
  
  Public dad As OleDbDataAdapter
  
  Protected Sub Page_Load(sender As Object, e As EventArgs)
  
  End Sub
  
  Protected Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged
  
  End Sub
  
  Protected Sub TextBox3_TextChanged(sender As Object, e As EventArgs) Handles TextBox3.TextChanged
  
  End Sub
  Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
  
      Dim connectionString As [String] = "Provider=Microsoft.ACE.OLEDB.12.0;Data" + " Source=App_Data/VQT_GL Testing.mdb"
      Dim ds As New DataSet()
      Dim conn As New OleDbConnection(connectionString)
      conn.Open()
  
  
      Dim cmd As New OleDbCommand("SELECT AVG(POLQA_Score) AS MEAN FROM VQTPOLQA WHERE VQT_Timestamp BETWEEN ? AND ?", conn)
      cmd.Parameters.AddWithValue("@StartDate", (TextBox3.Text))
      cmd.Parameters.AddWithValue("@EndDate", (TextBox2.Text))
  
      GridView1.DataSource = ds
  
  End Sub
  
  
  
  End Class
  </code></pre>
  
  <p><strong>ASPX CODE</strong></p>
  
  
  
  <pre><code>&lt;!DOCTYPE html&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head runat="server"&gt;
      &lt;title&gt;MOS FORM HOME&lt;/title&gt;
      &lt;script src="//code.jquery.com/jquery-1.10.2.js" type="text/javascript"&gt;&lt;/script&gt;  
      &lt;script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"type="text/javascript"&gt;&lt;/script&gt;  
      &lt;link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"/&gt; 
      &lt;script src="Scripts/jquery-1.4.1.min.js" type="text/javascript" &gt;&lt;/script&gt;
      &lt;script src="Scripts/jquery.dynDateTime.min.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="Scripts/calendar-en.min.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="Scripts/jquery-ui-timepicker-addon.js"&gt;&lt;/script&gt;
      &lt;link href="Styles/calendar-blue.css" rel="stylesheet" type="text/css" /&gt;
      &lt;link href="Styles/jquery-ui-timepicker-addon.css" rel="stylesheet"  type="text/css"/&gt;
  &lt;script type="text/javascript"&gt;
      $(document).ready(function () {
          $("#&lt;%=TextBox3.ClientID %&gt;").dynDateTime({
              showsTime: true,
              ifFormat: "%m/%d/%Y %H:%M:%S",
              daFormat: "%l;%M %p, %e %m, %Y",
              align: "BR",
              electric: false,
              singleClick: false,
              displayArea: ".siblings('.dtcDisplayArea')",
              button: ".next()"
          });
  
           $("#&lt;%=TextBox2.ClientID %&gt;").dynDateTime({
              showsTime: true,
              ifFormat: "%m/%d/%Y %H:%M:%S",
              daFormat: "%l;%M %p, %e %m, %Y",
              align: "BR",
              electric: false,
              singleClick: false,
              displayArea: ".siblings('.dtcDisplayArea')",
              button: ".next()"
          });
      });
  &lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form1" runat="server"&gt;
      &lt;div style="height: 74px"&gt;
  
          &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MOS FORM HOME PAGE&lt;/div&gt;
          &lt;p&gt;
              START DATE&amp;nbsp;&amp;nbsp;&amp;nbsp;
              &lt;asp:TextBox ID="TextBox3" runat="server" TextMode="DateTime" Width="181px"  BorderColor="Black" BorderStyle="Solid"&gt;&lt;/asp:TextBox&gt;&lt;img src="calender.png" /&gt;
  
          &lt;/p&gt;
          &lt;p&gt;
              END DATE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;asp:TextBox ID="TextBox2" runat="server" TextMode="DateTime" Width="188px" BorderColor="Black" BorderStyle="Solid"&gt;&lt;/asp:TextBox&gt;&lt;img src="calender.png" /&gt;
          &lt;/p&gt;
          &lt;p&gt;
              &amp;nbsp;&lt;/p&gt;
          &lt;p&gt;
              &lt;asp:Button ID="Button1" runat="server" Text="Submit" onclick="btnSave_Click"/&gt;
          &lt;/p&gt;
          &lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White" BorderColor="#336666" BorderStyle="Double" BorderWidth="3px" CellPadding="4" DataSourceID="SqlDataSource2" GridLines="Horizontal" Height="146px" Width="53px"&gt;
              &lt;Columns&gt;
                  &lt;asp:BoundField DataField="MEAN" HeaderText="MEAN" ReadOnly="True" SortExpression="MEAN" /&gt;
              &lt;/Columns&gt;
              &lt;FooterStyle BackColor="White" ForeColor="#333333" /&gt;
              &lt;HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" /&gt;
              &lt;PagerStyle BackColor="#336666" ForeColor="White" HorizontalAlign="Center" /&gt;
              &lt;RowStyle BackColor="White" ForeColor="#333333" /&gt;
              &lt;SelectedRowStyle BackColor="#339966" Font-Bold="True" ForeColor="White" /&gt;
              &lt;SortedAscendingCellStyle BackColor="#F7F7F7" /&gt;
              &lt;SortedAscendingHeaderStyle BackColor="#487575" /&gt;
              &lt;SortedDescendingCellStyle BackColor="#E5E5E5" /&gt;
              &lt;SortedDescendingHeaderStyle BackColor="#275353" /&gt;
          &lt;/asp:GridView&gt;
          &lt;asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="&lt;%$ ConnectionStrings:VQT_GL TestingConnectionString %&gt;" ProviderName="&lt;%$ ConnectionStrings:VQT_GL TestingConnectionString.ProviderName %&gt;" SelectCommand="SELECT AVG(POLQA_Score) AS MEAN FROM VQTPOLQA WHERE VQT_Timestamp BETWEEN ? AND ?"&gt;
              &lt;SelectParameters&gt;
                  &lt;asp:ControlParameter ControlID="TextBox3" DefaultValue="" Name="?" PropertyName="Text" /&gt;
                  &lt;asp:ControlParameter ControlID="TextBox2" DefaultValue="" Name="?" PropertyName="Text" /&gt;
              &lt;/SelectParameters&gt;
          &lt;/asp:SqlDataSource&gt;
  
          &lt;br /&gt;
  
          &lt;asp:AccessDataSource runat="server" DataFile="~/App_Data/VQT_GL Testing.mdb" SelectCommand="SELECT AVG(POLQA_Score) AS MEANPOLQA FROM VQTPOLQA WHERE (VQT_Timestamp BETWEEN ? AND ?)"&gt;
              &lt;SelectParameters&gt;
                  &lt;asp:ControlParameter ControlID="TextBox3" DefaultValue="" Name="?" PropertyName="Text" /&gt;
                  &lt;asp:ControlParameter ControlID="TextBox2" Name="?" PropertyName="Text" /&gt;
              &lt;/SelectParameters&gt;
          &lt;/asp:AccessDataSource&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>