Search code examples
asp.netc#-4.0entitydatasource

Where and AutoGenerateWhere in EntityDataSource


I keep getting this error and I think it's a Bug but I would like your opinions.

WhereParameters cannot be specified unless AutoGenerateWhere==true or Where is specified.

this is my entitydatasource control.

<asp:EntityDataSource ID="MtrlEntityDataSource" runat="server" 
    ConnectionString="name=AitisiEntities" DefaultContainerName="AitisiEntities" 
    EnableDelete="True" EnableFlattening="False" EnableInsert="True" Select="" AutoGenerateWhereClause="false"
    EnableUpdate="True" EntitySetName="MTRL" Where="it.SODTYPE = @sodTypeParam">
    <WhereParameters>
        <asp:Parameter DbType="Int32" DefaultValue="51" Name="@sodTypeParam" />
    </WhereParameters>
</asp:EntityDataSource>

Now do you see something wrong here? Tried in some projects and always keep failing.

Thank you.


Solution

  • Problem was so typical...long time to use parameters...

    Name="@sodTypeParam" 
    

    should be...

    Name="sodTypeParam" 
    

    For anyone looking for something similar and his mind is full....