CodeSmith Community
Your Code. Your Way. Faster!

ORDER BY on generated stored procs

Latest post 11-11-2006 9:59 PM by Knuckels23. 7 replies.
  • 11-09-2006 5:57 AM

    • Brett
    • Not Ranked
    • Joined on 10-11-2006
    • Posts 5
    • Points 145

    ORDER BY on generated stored procs

    Hi.

     
    Is there anyway to specify a sort order (Order by clause) for the auto generated stored procs?

     

    ~Brett 

    Filed under: ,
    • Post Points: 35
  • 11-09-2006 7:02 AM In reply to

    • swin
    • Top 10 Contributor
    • Joined on 06-14-2006
    • London, UK
    • Posts 925
    • Points 34,785

    Re: ORDER BY on generated stored procs

    xxx_GetPaged has the sort order on it.

    BTW: you could also do a sort on your TList (not so efficient I know)

    HTH

    swin

    ------------------------------------------------- Member of the .NetTiers team -------------------------------------------------
    • Post Points: 35
  • 11-09-2006 9:33 AM In reply to

    Re: ORDER BY on generated stored procs

    As does Find()

    On 11/9/06, swin <bounce-swin@codesmithsupport.com> wrote:

    xxx_GetPaged has the sort order on it.

    HTH

    swin






    Robert Hinojosa
    -------------------------------------
    Member of the Codesmith Tools, .netTiers, teams
    http://www.nettiers.com
    -------------------------------------
    • Post Points: 35
  • 11-09-2006 10:07 AM In reply to

    • swin
    • Top 10 Contributor
    • Joined on 06-14-2006
    • London, UK
    • Posts 925
    • Points 34,785

    Re: ORDER BY on generated stored procs

    Hi Robert,

    I looked at my generated xxx_Find SP's and I don't see any use of the "ORDER BY".

    I'm using templates from the 10/10 with sql2000.

    Don't these templates have it or am I missing something?

    swin

    ------------------------------------------------- Member of the .NetTiers team -------------------------------------------------
    • Post Points: 35
  • 11-09-2006 10:30 AM In reply to

    Re: ORDER BY on generated stored procs

    There are two Find methods, one used for column lookups, not the one i'm talking about, and a dynamic one that  uses parameterized sql.  There is no Stored Proc for that since it creates the Select Query dynamically.
     
    On 11/9/06, swin <bounce-swin@codesmithsupport.com> wrote:

    Hi Robert,

    I looked at my generated xxx_Find SP's and I don't see any use of the "ORDER BY".

    I'm using templates from the 10/10 with sql2000.

    Don't these templates have it or am I missing something?

    swin






    Robert Hinojosa
    -------------------------------------
    Member of the Codesmith Tools, .netTiers, teams
    http://www.nettiers.com
    -------------------------------------
    • Post Points: 35
  • 11-10-2006 2:26 AM In reply to

    • swin
    • Top 10 Contributor
    • Joined on 06-14-2006
    • London, UK
    • Posts 925
    • Points 34,785

    Re: ORDER BY on generated stored procs

    Hi Robert,

    Thanks for the info.

    Conincidently I had to use .Find today and I added a filter parameter of a datetime column. I set the value to be DateTime.Now.ToString("yyyy-MM-dd HH:mm") and the filter type as GreaterThanOrEquals but I find that the filter doesn't seem to be applied.

    I tried the logic direct in SQL and it returns what I expected.

    I also tried creating a "where" clause as "myfield >= '2006-11-10 21:00'" but this just gave me an exception saying that it wasn't supported in this version of Find??

    Any ideas on how I can get a Find to work with my DateTime column?

    TIA

    swin

    ------------------------------------------------- Member of the .NetTiers team -------------------------------------------------
    • Post Points: 35
  • 11-10-2006 9:44 AM In reply to

    Re: ORDER BY on generated stored procs

    Hey Swin,

    It would look like:
    EducationParameterBuilder build = new EducationParameterBuilder(false, false);
    build.AppendLessThanOrEqual(
    EducationColumn.LastDateUpdated, DateTime.Today.ToString());
    DataRepository.EducationProvider.Find(build.GetParameters());


    Robert Hinojosa
    -------------------------------------
    Member of the Codesmith Tools, .netTiers, teams
    http://www.nettiers.com
    -------------------------------------
    • Post Points: 35
  • 11-11-2006 9:59 PM In reply to

    Re: ORDER BY on generated stored procs

    Hey Robert,

    Is there any way to construct a order by query in the same way so that it hits the data base only once.

    thanks in advance, 

    cheers

    knuckels23

    • Post Points: 5
Page 1 of 1 (8 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems