Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 471
  • Last Modified:

movenext and movelast

what code to movenext and movelast record also the connection to database . its for paging but not use a datagrid.

thk
0
erpin
Asked:
erpin
  • 2
1 Solution
 
raterusCommented:
There are quite a bit of ways to access data in a database, can you be much more specific as to which objects you are using to do so?  
0
 
hismightinessCommented:
Yeah, exactly how/what are you trying to put together?
0
 
erpinAuthor Commented:
i use asp.net and vb language. My database is sql server ;
my question : 1. kind code to conect database
                     2. how to movenext or move last record??

all from code behind
0
 
hismightinessCommented:
You sound like I did when I first came into the .Net world because I was used to VBScript and ASP.  It was very hard to get out of thinking in terms of Recordset and ADO functionality, but you have a much broader range of functionality and possibilities with ADO.Net.  

Here is an example though:

        ' make your connection
        Dim conn As New SqlConnection("server=SERVERNAME;database=DBNAME;User Id=USERNAME;Password=PASSWORD;")
        ' use a command
        Dim cmd As New SqlCommand("SELECT STATEMENT", conn)
        ' insert the command into a dataadapter
        Dim da As New SqlDataAdapter(cmd)
        Dim ds As New DataSet
        ' fill the dataset
        da.Fill(ds, "TABLENAME")
        Dim dv As DataView = New DataView(ds.Tables("TABLENAME"))

        Dim strFirstValue, strLastValue As String
        strFirstValue = dv.Item(0)("FIELDNAME")
        strLastValue = dv.Item(dv.Count)("FIELDNAME")

        ' finish it up
        dv.Dispose()
        ds.Dispose()
        da.Dispose()
        conn.Dispose()
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now