hello guys i am developing some project using vb.net 2010 i have 1 table with12 columns. i have 1 datagridview in one vb form, and on the data gridview1 all data is populated from ms-sql database well...its work fine. but my question is i wont to populate/see only 10 records, if it is possible users click next button and datagrid will show the next 10 records. how can i do this,
here is my code to populate the data
private Sub MDIParent1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
GetData("select [ID],[DocId],[Description] ,[Address] ,[NoOfPages] ,[SendOrReceived] ,[SentDate] ,[ReceivedDate] ,[ForwardedWorkingUnit] ,[Attachements] ,[ForwardedDate] ,[ReceivedBy] ,[LetterWrittenDate] ,[DocPath] FROM [Data].[dbo].[EraDms]ORDER BY Id DESC")
Me.DataGridView1.DataSource = Me.bindingSource1
End Sub
Private Sub GetData(ByVal selectCommand As String)
Try
Dim connectionString As String = _
"Server=servername;Network Library=DBMSSOCN;Initial Catalog=Data;User ID=sa;Password=P@ssw0rd;"
Me.dataAdapter = New SqlDataAdapter(selectCommand, connectionString)
Dim commandBuilder As New SqlCommandBuilder(Me.dataAdapter)
table.Locale = System.Globalization.CultureInfo.InvariantCulture
Me.dataAdapter.Fill(table)
Me.bindingSource1.DataSource = table
Me.DataGridView1.AutoResizeColumns( _
DataGridViewAutoSizeColumnsMode.ColumnHeader)
DataGridView1.Columns(0).Visible = False
Catch ex As SqlException
End Try
End Sub