Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. how to use TOP N in c#.net ?

how to use TOP N in c#.net ?

Scheduled Pinned Locked Moved C#
csharphelptutorialquestion
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    horacyjr
    wrote on last edited by
    #1

    i need a help using crystal.net with c#.net here is my problem: i want to use TOP N propriety in code on c#.net, but i just know how to do it on crystal, can anybody help me ? tks

    C J 2 Replies Last reply
    0
    • H horacyjr

      i need a help using crystal.net with c#.net here is my problem: i want to use TOP N propriety in code on c#.net, but i just know how to do it on crystal, can anybody help me ? tks

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      horacyjr wrote:

      i want to use TOP N propriety in code on c#.net, but i just know how to do it on crystal, can anybody help me ?

      TOP N? In C#? I think you are getting confused with SQL. In SQL you can do something like this:

      SELECT TOP 10 * FROM MyTable

      If this is not what you are looking for please clarify your request.


      My: Blog | Photos "Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious

      1 Reply Last reply
      0
      • H horacyjr

        i need a help using crystal.net with c#.net here is my problem: i want to use TOP N propriety in code on c#.net, but i just know how to do it on crystal, can anybody help me ? tks

        J Offline
        J Offline
        Johny Ng
        wrote on last edited by
        #3

        In Sql server, you can specify "N" dynamically but you have to use dynamic query.

        C 1 Reply Last reply
        0
        • J Johny Ng

          In Sql server, you can specify "N" dynamically but you have to use dynamic query.

          C Offline
          C Offline
          Colin Angus Mackay
          wrote on last edited by
          #4

          Only for SQL Server 2000. In SQL Server 2005 you can specify N with a variable.

          SELECT TOP @numRows * FROM MyTable


          My: Blog | Photos "Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious

          J L 2 Replies Last reply
          0
          • C Colin Angus Mackay

            Only for SQL Server 2000. In SQL Server 2005 you can specify N with a variable.

            SELECT TOP @numRows * FROM MyTable


            My: Blog | Photos "Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious

            J Offline
            J Offline
            Johny Ng
            wrote on last edited by
            #5

            Good to know. Thanks

            1 Reply Last reply
            0
            • C Colin Angus Mackay

              Only for SQL Server 2000. In SQL Server 2005 you can specify N with a variable.

              SELECT TOP @numRows * FROM MyTable


              My: Blog | Photos "Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious

              L Offline
              L Offline
              leppie
              wrote on last edited by
              #6

              Yeah that one got me on SQL2000 too :( xacc.ide-0.1.0.11 released! Now working properly under .NET 2 :) Download and screenshots

              H 1 Reply Last reply
              0
              • L leppie

                Yeah that one got me on SQL2000 too :( xacc.ide-0.1.0.11 released! Now working properly under .NET 2 :) Download and screenshots

                H Offline
                H Offline
                horacyjr
                wrote on last edited by
                #7

                this was the answwer , thanks for helping http://msdn.microsoft.com/library/default.asp?url=/library/en-s/crystlrf/html/crlrftopbottomnsortfieldclasstopic.asp private TopBottomNSortField GetTopBottomNSortField (int sortFieldIndex) { TopBottomNSortField topBottomNSortField; // Get the SortField object by index, cast it as a // TopBottomNSortField object, and return it. topBottomNSortField = Report.DataDefinition.SortFields[sortFieldIndex] as TopBottomNSortField; if (topBottomNSortField != null) return topBottomNSortField; else return null; }

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups