Missing operand before 'Mod' operator

Joined
May 5, 2011
Messages
2
Reaction score
0
Hi everyone,

I have this error message when I open my page. I know where the problem is but I cannot fix it. Can anyone help me? I will include the code below and I will also make clear the area where the problem is

Code:
<%@ Page Title="" Language="C#" MasterPageFile="Site.master" AutoEventWireup="true" CodeFile="UserRequests.aspx.cs" Inherits="UserRequests" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<form id="form_deptProfile" runat="server">
    <h1>
        Department Profile
    </h1>
     <em>View / Filter request(s)</em>
    <br />
<asp:SqlDataSource ID="SqlDataSource1" 
            runat="server" 
            ConnectionString="<%$ ConnectionStrings:sqlteam07ConnectionString %>" 
            
        SelectCommand="SELECT Request.requestID, Request.students, Request.day, Request.period, Request.priority, Request.duration, Request.roomStyle, Request.roomsRequired, Request_Round.roundName, Room.roomCode, Room.capacity, Park.parkLocation, Request_Status.statusName, Timetablers.DepartmentdeptCode, Module.ownerdeptCode + Module.moduleYear + Module.moduleCode AS ModuleCode FROM Request_Status INNER JOIN Request INNER JOIN Request_Round ON Request.Request_RoundroundID = Request_Round.roundID ON Request_Status.statusID = Request.Request_StatusstatusID INNER JOIN Timetablers ON Request.TimetablersTimetablerID = Timetablers.TimetablerID INNER JOIN Request_Room ON Request.requestID = Request_Room.RequestrequestID INNER JOIN Park INNER JOIN Room ON Park.parkLocation = Room.ParkparkLocation ON Request_Room.RoomroomCode = Room.roomCode INNER JOIN Module ON Request.ModulemoduleuniqueID = Module.moduleuniqueID WHERE (Timetablers.DepartmentdeptCode = 'TT')">
        </asp:SqlDataSource>

<table style="width: 650px" border="0" cellpadding="0" cellspacing="1" 
class="GridviewTable">
<tr>
    <td style="width: 50px;">
        ID
    </td>
    <td style="width: 150px;">
        Priority</td>
    <td style="width: 150px;">
        Students</td>
    <td style="width: 150px;">
        Day</td>
    <td style="width: 150px;">
        Period</td>
</tr>
<tr>
    <td style="width: 50px;">
    </td>
    <td style="width: 150px;">
    </td>
    <td style="width: 150px;">
    </td>
    <td style="width: 150px;">
        <asp:DropDownList ID="ddldepartment" DataSourceID="dsPopulateDepartment" 
            AutoPostBack="true" DataValueField="day" runat="server" Width="130px" 
            Font-Size="11px" AppendDataBoundItems="true">
            <asp:ListItem Text="All" Value="%"></asp:ListItem>
        </asp:DropDownList>
    </td>
    <td style="width: 150px;">
        <asp:DropDownList ID="ddlLocation" DataSourceID="dsPopulateLocation" 
            AutoPostBack="true" DataValueField="period" runat="server" Width="130px" 
            Font-Size="11px" AppendDataBoundItems="true">
            <asp:ListItem Text="All" Value="%"></asp:ListItem>
        </asp:DropDownList>
    </td>
</tr>
<tr>
    <td colspan="5">
        <asp:GridView ID="Gridview2" runat="server" AutoGenerateColumns="False" 
            AllowPaging="True" AllowSorting="true" DataSourceID="dsGridview" 
            Width="650px" PageSize="10" CssClass="Gridview">
            <Columns>
                <asp:BoundField DataField="requestID" HeaderText="Sort" SortExpression="requestID" 
                    ItemStyle-Width="50px" ItemStyle-HorizontalAlign="Center" />
                <asp:BoundField DataField="priority" HeaderText="Sort" 
                    SortExpression="priority" ItemStyle-Width="150px" />
                <asp:BoundField DataField="students" HeaderText="Sort" 
                    SortExpression="students" ItemStyle-Width="150px" />
                <asp:BoundField DataField="day" HeaderText="Sort" 
                    SortExpression="day" ItemStyle-Width="150px" />
                <asp:BoundField DataField="period" HeaderText="Sort" 
                    SortExpression="period" ItemStyle-Width="150px" />
            </Columns>
        </asp:GridView>
    </td>
</tr>
</table>

<asp:SqlDataSource ID="dsPopulateDepartment" 
            runat="server" 
            ConnectionString="<%$ ConnectionStrings:sqlteam07ConnectionString %>" 
        SelectCommand="SELECT day FROM [Request]">
        </asp:SqlDataSource>
<asp:SqlDataSource ID="dsPopulateLocation" 
            runat="server" 
            ConnectionString="<%$ ConnectionStrings:sqlteam07ConnectionString %>" 
        SelectCommand="SELECT period FROM [Request]">
        </asp:SqlDataSource>
        

        <asp:SqlDataSource ID="dsGridview" runat="server" 
    ConnectionString="<%$ ConnectionStrings:sqlteam07ConnectionString %>" 
    SelectCommand="SELECT * FROM [Request]" FilterExpression="'day' ={0}">
    <FilterParameters>
        <asp:ControlParameter Name="day" ControlID="ddldepartment" 
            PropertyName="SelectedValue" />
        <asp:ControlParameter Name="period" ControlID="ddllocation" 
            PropertyName="SelectedValue" />
    </FilterParameters>
</asp:SqlDataSource>
    </form>
</asp:Content>

The problem is on the FilterExpression which is shown here clearly

Code:
FilterExpression="'day' ={0}">

Can anybody help me please?
 
I have found the solution guys and I will post it here in case that anybody else faces the same problem in the future. The solution is to make it like that:

Code:
FilterExpression="CONVERT(day,'System.String') like '{0}'"
 
Back
Top