VB.net load first 500 lines of DataTable

I use the following code to populate a DataGridView.
Is it possible to load only the first 500 lines into the DataGridView

         Dim oConnectionString As String = Globals.ThisAddIn.oRIGHT.lblConnectionString.Text
                Dim con As SqlConnection = New SqlConnection(oConnectionString)
                Dim sSQL As String = Globals.ThisAddIn.oBOTTOM.txtSQL.Text
                Dim da As SqlDataAdapter = New SqlDataAdapter(sSQL, con)
                da.Fill(ds, "MyTable")
                DataGridView1.DataSource = ds.Tables("MyTable")
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?
Éric MoreauConnect With a Mentor Senior .Net ConsultantCommented:
can't you just change your sSQL to include a TOP 500 clause?
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.