首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

出现Operator '==' incompatible with operand types 'Int32' and

2012-12-17 
出现Operator '' incompatible with operand types 'Int32' and 'Object'

出现Operator '==' incompatible with operand types 'Int32' and 'Object'
<asp:GridView ID="GridView5" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="CategoryId" DataSourceID="LinqDataSource1"  >
            <Columns>
                <asp:CommandField ShowSelectButton="True" />
                <asp:BoundField DataField="CategoryId" HeaderText="CategoryId" 
                    InsertVisible="False" ReadOnly="True" SortExpression="CategoryId" />
                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                <asp:BoundField DataField="Descn" HeaderText="Descn" SortExpression="Descn" />
            </Columns>
        </asp:GridView>
        <asp:LinqDataSource ID="LinqDataSource1" runat="server" 
            ContextTypeName="DatabaeseDataContext" EntityTypeName="" TableName="Categories">
        </asp:LinqDataSource>
        <asp:DetailsView ID="DetailsView2" runat="server" AutoGenerateRows="False" 
            DataKeyNames="CategoryId" DataSourceID="LinqDataSource8" Height="50px" 
            Width="202px">
            <Fields>
                <asp:BoundField DataField="CategoryId" HeaderText="CategoryId" 
                    InsertVisible="False" ReadOnly="True" SortExpression="CategoryId" />
                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                <asp:BoundField DataField="Descn" HeaderText="Descn" SortExpression="Descn" />
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                    ShowInsertButton="True" />
            </Fields>
        </asp:DetailsView>
                <asp:LinqDataSource ID="LinqDataSource8" runat="server" 
            ContextTypeName="DatabaeseDataContext" EnableDelete="True" EnableInsert="True" 


            EnableUpdate="True" EntityTypeName="" TableName="Categories" 
            Where="CategoryId ==@CategoryId"  >    -------就是这里出现错误
            <WhereParameters>
                <asp:ControlParameter ControlID="GridView5" Name="CategoryId" 
                    PropertyName="SelectedValue" Type="Int32" />
            </WhereParameters>
        </asp:LinqDataSource>


求解答。。谢谢
[最优解释]
@CategoryId啥东西,解析不了,谁知到它代表什么int值
[其他解释]
Where="CategoryId ==@CategoryId

只看见了两个“==”,可以这样写吗?

重载运算符的操作c#还是基本没有的(还没见),linq 会报这个错误,挺有意思的。
[其他解释]

引用:
Where="CategoryId ==@CategoryId

只看见了两个“==”,可以这样写吗?

重载运算符的操作c#还是基本没有的(还没见),linq 会报这个错误,挺有意思的。


这个是什么? 判断 还是? LZ 这是干啥呢?
[其他解释]
倒数第三行不是 有PropertyName="SelectedValue" Type="Int32" />么
怎么还会报错啊?

热点排行