0
    string check = "SELECT * FROM portalEntries ORDER BY date DESC";
    SqlCommand cmd = new SqlCommand(check, myConnection);
    SqlDataReader queryCommandReader = cmd.ExecuteReader();

    while (queryCommandReader.Read())
    {
        int dbId = queryCommandReader.GetInt32(0);
        Response.Write(dbId.ToString());
        Response.Write("\n");
        //string name = queryCommandReader.GetString(0);
        //Response.Write(name);
    }         

It works and give all id's in one page but I want to 15 id's records per page.I have searched it but cant getting the right answer.

Ashwini Verma
  • 7,288
  • 4
  • 33
  • 56

2 Answers2

0

Use ASP.NET GridView and apply Paging on it. Here is a reference MSDN page: http://msdn.microsoft.com/en-us/library/aa479347.aspx

Vishy
  • 1,194
  • 10
  • 16
-1
"SELECT * FROM portalEntries ORDER BY date DESC LIMIT 0,15"

will give you the first 15. But you will need a new variable which should be passed that you know on which page you are

Xavjer
  • 7,803
  • 2
  • 19
  • 39
  • He just did not mention the SQL he is using (Works for SQLite too!), if he uses oracle he could try http://stackoverflow.com/questions/470542/how-do-i-limit-the-number-of-rows-returned-by-an-oracle-query-after-ordering – Xavjer Apr 19 '13 at 12:58