How can i move to next, prev,last,first records in ASP.NET? it was like DB.MoveNext in ASP but i dont know how in ASP.NET !

Thanks

hi,
i use sqlserver2000 for database. i can list 1st record 5 times. but i dont want that. i want to list first 5 record. i dont know how to do movenext, moveprev,first,last.
if sqlserver is making problem i can use access too.
thank you

no, i mean asp.net objects are you using to access the database. Datatable, DataGrid, etc? It might be easier if you post a snippet of code.

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim i As Integer
Dim sayac As Integer

Label1.Text = DropDownList1.Text
Label2.Text = DropDownList2.Text

sayac = 0

i = 1 + (DropDownList2.Text - DropDownList1.Text)

Dim database As SqlConnection
Dim sorgu As SqlCommand
Dim kisiler As SqlDataReader

database = New SqlConnection("SERVER=sqlim\instance2000;DATABASE=inandbf;User Id=abcdef;Password=123456;")
sorgu = New SqlCommand("SELECT number, name, surname FROM veriler WHERE number=@number", database)

sorgu.Parameters.AddWithValue("@number", DropDownList1.Text)
database.Open()

kisiler = sorgu.ExecuteReader()

Do While kisiler.Read()

For sayac = 1 To i
Response.Write(kisiler("number"))
Response.Write(kisiler("name"))
Response.Write(kisiler("surname"))
Response.Write("<BR>")

Next sayac
Loop

kisiler.Close()
database.Close()
End Sub

This article has been dead for over six months. Start a new discussion instead.