User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 402,035 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,426 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.

I want next record to Display

Join Date: Mar 2006
Posts: 104
Reputation: manal is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 12
manal's Avatar
manal manal is offline Offline
Junior Poster

Re: I want next record to Display

  #2  
Aug 4th, 2007
Dim conn As New SqlConnection(connstr1)
Dim sql As String
sql = "Select * from address1"
'Dim da As SqlDataAdapter
Dim cmd As New SqlCommand(sql, conn)
conn.Open()
Dim ds As New DataSet()
da = New SqlDataAdapter(sql, conn)
da.Fill(ds, "Address1")
maxrows = ds.Tables("Address1").Rows.Count
inc = -1
conn.Close()
If inc <> maxrows - 1 Then
inc = inc + 1
TextBox1.Text = ds.Tables("address1").Rows(inc).Item("rollno").ToString
TextBox2.Text = ds.Tables("address1").Rows(inc).Item("name").ToString
End If

first this code must be written in the next_button (by double click next_button to access its code )
second you need to initiate the variable inc outside the next button code (global variable)
in your code now , each time you click next, inc will be -1 at start and therefore always the same record will be displayed
"give only what u willing to receive "
Reply With Quote  
All times are GMT -4. The time now is 10:50 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC