Solved

VB.net load first 500 lines of DataTable

Posted on 2013-01-19
2
236 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:murbro
2 Comments
 
LVL 70

Accepted Solution

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

Author Closing Comment

by:murbro
ID: 38797864
Thanks
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

839 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