473,657 Members | 2,634 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

filling dataset with first N records of query

VMI
I need to display Access data in a datagrid but the Access table has over 2
million records. Since I can't fill a datatable with all those records but
the user needs to see all of them, how can I fill the datatable with a
subset of the initial query result? In the windows Form, under the datagrid,
I was thinking of adding a "Next" button that would display the next N
records from the initial query, and a "Previous" that would display the
previous N records. Is that possible?

Thanks..
Nov 16 '05 #1
1 2758
Hello!

Yes, this is possible - and quite easy. Two million records in an Access
database sounds like an awful lot of records for Access, but I guess you
already know this.

It's been some time since I worked with Access, but I will try to outline
two solutions. As always, it's desired to retrieve as few records as
necessary from the datastore - preferable those records matching the page
you want to display. Check links [1] and [2] from a quick Google search.

Solution 1. Create a SQL query that uses a nested query to return the top of
those records you'd want to retrieve.

Calculate the size of your current page. e.g. Page nr. 5 with 25 records
each. I haven't tested this particular query, but it should get you going in
the right direction.

SELECT TOP 25 FROM Table WHERE TableID IN (
SELECT TOP (5 x 25) TableID FROM Table ORDER BY Date DESC
)
ORDER BY Date

Solution 2.
Create a regular SQL SELECT query, but make sure you're getting a firehose
cursor when executing the SQL query. Then move to the desired page position.
I haven't tested this in the .NET environment yet, but I have seen this
working in ASP 3.0 with an Access DB and close to 1 mio. records - so it
might work here too.
I need to display Access data in a datagrid but the Access table has over 2 million records. Since I can't fill a datatable with all those records but
the user needs to see all of them, how can I fill the datatable with a
subset of the initial query result? In the windows Form, under the datagrid, I was thinking of adding a "Next" button that would display the next N
records from the initial query, and a "Previous" that would display the
previous N records. Is that possible?


[1] : http://www.winnetmag.com/SQLServer/A...505/40505.html
[2] :
http://www.experts-exchange.com/Data..._21135918.html

--
venlig hilsen / with regards
anders borum
--
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
4002
by: Eric Petruzzelli | last post by:
If I fill my dataset and there is no data. The dataset is still created with zero rows (all columns are there). When I add my first row using the script below, it takes over 2 seconds to add??? If I add the second row, instant. How can I eliminate this delay?
1
2892
by: allyn44 | last post by:
Hello--i have inherited a dataset that has records like below: id locationid 1 7 2 3 5 4 5 6 4
6
17152
by: Brian | last post by:
Hello, Basically, I'm running a query on a form's activation, and I'd like to have the results of the query be placed into other fields on the same form automatically. Does anybody know how this can be done? I've tried setting the default value of the text fields on the form to be equal to ! using Access' expression
4
2928
by: Michael Jones | last post by:
Ok.......... I'm trying to fill a parameterized table onto a Dataset via a sqlDataAdapter. It works fine if I fill the Dataset with all the column fields. What I want to do though is to only fill the Dataset with certain values from my DateTimeIn column (i.e. only files where DateTimeIn == user-defined date). This isn't working. I'm sure my query is correct because I've used the same code in different projects: SELECT...
2
1361
by: DC Gringo | last post by:
This code has two SELECT statements, each returning several records. I want to fill a dataset and then two datagrids. How would I fill the SECOND datagrid from this code ----- Sub BindSQL() Dim MyConnection As SqlConnection Dim DS as DataSet
3
1998
by: crjunk | last post by:
I have a 3 table in my DataSet that I'm filling with data. After I've filled these 3 tables, I'm then trying to run a query that will fill a 4th table in the DataSet with data from the three tables that are already pouplated. When my code tries to fill the 4th table, ReportData, I receive the following error message: Invalid object name 'tmpPROJECTINFO'. Invalid object name 'tmpContacts'. Invalid object name 'tmpRECEIVEREC'. Can...
2
1265
by: SMG | last post by:
Hi there, I have a dataset in memory, which is filled with 1000 records. If the records are changed in the database, I want to reflect the changes to the previous records that means: Dataset 1 : Table 1 Id Name ReportID 1 Shailesh 001
0
964
by: Martin Arvidsson \(Visual Systems AB\) | last post by:
Hi all gurus out there! When i use the Wizard to create some fields from a table it creates, the dataset, bindingsource and tableadapter. Now for the problem. When i open that form in my program, it automaticly fills the dataset with all the records in the table. In this case there is over one milion records. It takes ages to fill the dataset and view the form.
3
2834
by: Ken Fine | last post by:
This is a question that someone familiar with ASP.NET and ADO.NET DataSets and DataTables should be able to answer fairly easily. The basic question is how I can efficiently match data from one dataset to data in a second dataset, using a common key. I will first describe the problem in words and then I will show my code, which has most of the solution done already. I have built an ASP.NET that queries an Index Server and returns a...
0
8407
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8319
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8739
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8512
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6175
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5638
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4171
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.