locked
Grid Access DB Select statement using the day of the week # in with where statement RRS feed

  • Question

  • User-544860796 posted

    Hi,

    I am trying to create a grid which will read the data from an access database and select items based on the day of the week. I am using expression web 4.0. I am able to create the grid and have the data populate all the records when I leave off the "where". My problem arises when I try to limit the data using the "where" clause.

    I am not sure if I am using the right syntax, dim.

     

    Thanks

    Kip

     

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <%@ Page Language="VB" %>
    <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">


    <head runat="server">
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
    <title>Untitled 1</title>
    </head>

    <%
     Dim dowNumber as integer
     Dim dowString as string
     
     dowNumber= Weekday(Today) - 1
     dowString= cStr(dowNumber)
     
     %>
     

    <body>

    <form id="form1" runat="server">
     <asp:GridView id="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="AccessDataSource1">
      <Columns>
       <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID">
       </asp:BoundField>
       <asp:BoundField DataField="Day" HeaderText="Day" SortExpression="Day">
       </asp:BoundField>
       <asp:BoundField DataField="Time of Day" HeaderText="Time of Day" SortExpression="Time of Day">
       </asp:BoundField>
       <asp:BoundField DataField="Start Time" HeaderText="Start Time" SortExpression="Start Time">
       </asp:BoundField>
       <asp:BoundField DataField="Duration" HeaderText="Duration" SortExpression="Duration">
       </asp:BoundField>
       <asp:BoundField DataField="Class" HeaderText="Class" SortExpression="Class">
       </asp:BoundField>
       <asp:BoundField DataField="Location" HeaderText="Location" SortExpression="Location">
       </asp:BoundField>
       <asp:BoundField DataField="Instructor" HeaderText="Instructor" SortExpression="Instructor">
       </asp:BoundField>
      </Columns>
     </asp:GridView>
     <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="../App_Data/synergyDB.mdb" SelectCommand="SELECT * FROM [Schedule] WHERE ([Day] = ?)">
      <SelectParameters>
       <asp:FormParameter FormField="dowString" Name="Day" Type="Int32" />
      </SelectParameters>
     </asp:AccessDataSource>
    </form>

    </body>

    </html>

    Thursday, December 9, 2010 6:43 PM

Answers

All replies