none
EntityDataSource with sub-query in "Where" RRS feed

  • Question

  • Hello!

    I have a question about the "where" from the EntityDataSource.

    In SQL Server 2012 i created a working query.

    I want to translate this to the EntityDataSource (see code beneath) but this does not work. Does someone know if its possible to have a sub-query in the "where" of the EntityDataSource?? and does someone know how i can make this work?

    <asp:EntityDataSource ID="dsCurrent9999" runat="server" EnableInsert="true" EnableUpdate="true" EnableDelete="true"
        ConnectionString="name=CJIBIBBConnection"
        DefaultContainerName="CJIBIBBConnection" EntitySetName="CJIB_STATUS"
        OrderBy="it.[STA_ID]"
        Include="CJIB_BESCHIKKING, CJIB_SOORT_STATUS, CJIB_GEBRUIKER, CJIB_STATUS"
        Where="(it.STA_ID =
                                 EXISTS(SELECT        MAX(it.STA_ID) AS Expr1
                                   FROM            CJIB_STATUS AS B
                                   WHERE        (it.STA_BES_ID = B.STA_BES_ID))) AND (it.STA_SST_ID = 9999)">
    </asp:EntityDataSource>

    Greetings Dennis.

    Thursday, November 7, 2013 3:42 PM

Answers

  • Hello,

    >>Does someone know if its possible to have a sub-query in the "where" of the EntityDataSource?

    The answer is yes.

     >>and does someone know how i can make this work?

    For filtering Data in EntityDataSource, please have a look at the link below:

    http://msdn.microsoft.com/en-us/library/cc488531(v=vs.100).aspx

    It shows a detail sample to use where in EntityDataSource.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, November 8, 2013 6:54 AM
    Moderator