Get row count in SQL?

Discussion in 'Questions (Windows Mobile)' started by N1c0_ds, Oct 23, 2008.

  1. N1c0_ds

    N1c0_ds Active Member Licensed User

    I need to get the total row count for the "Main" table in my SQL DB but can't find out how to get it.

    I made a touch scrollbar for Gecko that gets 12 entries from an offset determined by the Mousedown coordinates and displays them with FDrawString.

    This is how I get the OFFSET value for my query:
    Then I do this to display 12 results I will show with Drawstring on my Form (The background image is the UI)

     
  2. Ricky D

    Ricky D Well-Known Member Licensed User

    what count?

    Do you want a count of all entries?

    If so then use

    SQLCmd.CommandText="SELECT Count(Name) From Main"

    it will be returned in reader's getvalue(0) item after you set the reader to SQLCmd's executereader method

    if you're going to apply a Where clause then add it like this

    SQLCmd.CommandText="SELECT Count(Name) From Main Where <fieldname>='something or other'"

    regards, Ricky
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice