?
Solved

VB.net load first 500 lines of DataTable

Posted on 2013-01-19
2
Medium Priority
?
249 Views
Last Modified: 2013-01-19
Hi
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
                con.Open()
                Dim da As SqlDataAdapter = New SqlDataAdapter(sSQL, con)
                da.Fill(ds, "MyTable")
                DataGridView1.DataSource = ds.Tables("MyTable")
0
Comment
Question by:Murray Brown
2 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 2000 total points
ID: 38797014
can't you just change your sSQL to include a TOP 500 clause?
0
 

Author Closing Comment

by:Murray Brown
ID: 38797864
Thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question