chandu gummadi

chandu gummadi

  • NA
  • 67
  • 73.5k

DISPLAY DATABASE DATA INTO TEXTBOXES

Sep 5 2014 2:07 AM
HI FRIENDS I TO WANT DISPLAY DATABASE DATA IN TO TEXT BOXES HERE IAM USING FIRST NEXT PREVIOUS LAST BUTTONS..

I HAVE WRITTEN THE CODE BUT ITS NOT WORKING PROPERLY IT WORKS FOR FIRST AND LAST BUTTONS CLICK EVENTS IT DISPLAYS DATABASE DATA INTO TEXT BOXES BUT WHEN IAM CLICK NEXT AND PREVIOUS BUTTONS IT DOES NOT WORK PROPERLY IT WORKS ONLY DISPLAYS FIRST TIME CORRECTLY SECOND TIME IAM CLICKING PREVIOUS BUTTON IT DOES NOT DISPLAY PREVIOUS RECORD IN THE TEXTBOXES IT DISPLAYS SAME RECORD IN TEXTBOX.

HERE IS MY CODE PLEASE HELP ME FOR THIS PROBLEM..
 
Dim rno As Integer 
cmd.CommandText = " select * from customerr"    
Dim da As New SqlDataAdapter         
Dim dt As New DataTable         
da.SelectCommand = cmd         
cmd.Connection = connection         
da.Fill(dt)           
rno = dt.Rows.Count - 1        
 If rno > 0 Then            
 rno -= 1             
If dt.Rows.Count > "0" Then                 
txtcustid.Text = dt.Rows(rno)(0).ToString()                
txtcustname.Text = dt.Rows(rno)(1).ToString()                
txtcustaddress.Text = dt.Rows(rno)(2).ToString()                            
End If
End If
 
cmd.CommandText = "select * from customerr"         
Dim da As New SqlDataAdapter         
Dim dt As New DataTable         
da.SelectCommand = cmd         
cmd.Connection = connection         
da.Fill(dt)                 
rno = dt.Rows.Count - 1         
If rno < dt.Rows.Count - 1 Then             
rno += 1             
If dt.Rows.Count &gt; rno Then                 
txtcustid.Text = dt.Rows(rno)(0).ToString()                 
txtcustname.Text = dt.Rows(rno)(1).ToString()                 
txtcustaddress.Text = dt.Rows(rno)(2).ToString()                             
End If         
End If