CSLA .NET

From Rockford Lhotka's Expert C# 2005 and VB 2005 Business Objects books

Welcome to CSLA .NET Sign in | Join | Help
in Search

LINQ Question

Last post 05-20-2008, 10:40 AM by RedmondScorpio. 1 replies.
Sort Posts: Previous Next
  •  05-17-2008, 4:54 PM 23636

    LINQ Question

    I am trying to do the following.
     
    1. Using DataLinq = ContextManager(Of SystemDataLinqDataContext).GetManager("ConnectionString")
    2.             Dim DataResult = From CompanyItem In DataLinq.DataContext.spGetCompanies( _
    3.                                      CompanyPageIndex, _
    4.                                      CompanyPageSize, _
    5.                                      CompanyActive, _
    6.                                      _totalRecordCount) Order By SortBy.ToString _
    7.         Select New CompanyRO( _
    8.             CompanyItem.CompanyID, _
    9.             CompanyItem.CompanyTypeID, _
    10.             CompanyItem.CompanyTypeDescription, _
    11.             CompanyItem.CompanyTypeActive, _
    12.             CompanyItem.Name, _
    13.             CompanyItem.Description, _
    14.             CompanyItem.RoleID, _
    15.             CompanyItem.Website, _
    16.             CompanyItem.Username, _
    17.             CompanyItem.Password, _
    18.             CompanyItem.CompanyLookUpCode, _
    19.             CompanyItem.Active)
    20.  
    21.             AddRange( _
    22.                 DataResult)
    23.         End Using
    For some reseason, the "SortBy.ToString" parameter that I am passing in doesn't order the list.
  •  05-20-2008, 10:40 AM 23700 in reply to 23636

    Re: LINQ Question

    Hello,

    The order by clause should be something like:

    Order By CompanyItem.FieldNameInResultSet

    Are you trying to dynamically set the order by field name?

    If so, here is an article abou that.  http://blogs.vertigo.com/personal/jeffv/Blog/Lists/Posts/Post.aspx?ID=10

View as RSS news feed in XML

Please contact Magenic for your .NET consulting and CSLA .NET mentoring needs.
Please consider making a donation to help support the ongoing development of CSLA .NET.

Make donation through PayPal - it's fast, free and secure!
Why donate?
Powered by Community Server, by Telligent Systems