473,810 Members | 2,948 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Anyone know how to get certain no of recirds from a dataView?

I am trying ot get a certain no of records from a DataView. I am looking ot
do like a Top 15 in Sql, Is there a easy way to do this or should I loop till
the count?
Appreciate any help.

--
Live one day at a time.
Nov 19 '05 #1
3 1025
I think you have to loop.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"redmond" <re*****@discus sions.microsoft .com> wrote in message
news:03******** *************** ***********@mic rosoft.com...
I am trying ot get a certain no of records from a DataView. I am looking ot do like a Top 15 in Sql, Is there a easy way to do this or should I loop till the count?
Appreciate any help.

--
Live one day at a time.

Nov 19 '05 #2
I use two approaches;

Form the Sql with the "TOP n" constraint, do the query, and make the
resulting DataTable your data source (if you're using databinding).

When I'm doing pagination, I use DataAdapter.Fil l (). As I understand it,
Fill isn't really much more efficient than writing a loop, but the code
looks far cleaner.

"redmond" <re*****@discus sions.microsoft .com> wrote in message
news:03******** *************** ***********@mic rosoft.com...
I am trying ot get a certain no of records from a DataView. I am looking ot do like a Top 15 in Sql, Is there a easy way to do this or should I loop till the count?
Appreciate any help.

--
Live one day at a time.

Nov 19 '05 #3
Thank you all, I finally found the PagedDataSource thru which I cna pick the
no of records I want.

"MWells" wrote:
I use two approaches;

Form the Sql with the "TOP n" constraint, do the query, and make the
resulting DataTable your data source (if you're using databinding).

When I'm doing pagination, I use DataAdapter.Fil l (). As I understand it,
Fill isn't really much more efficient than writing a loop, but the code
looks far cleaner.

"redmond" <re*****@discus sions.microsoft .com> wrote in message
news:03******** *************** ***********@mic rosoft.com...
I am trying ot get a certain no of records from a DataView. I am looking

ot
do like a Top 15 in Sql, Is there a easy way to do this or should I loop

till
the count?
Appreciate any help.

--
Live one day at a time.


Nov 19 '05 #4

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

Similar topics

9
2590
by: jwedel_stolo | last post by:
Hi I'm creating a dataview "on the fly" in order to sort some data prior to writing out the information to a MS SQL table I have used two methods in order to determine the sort order of the DataView. (I'm writing in C# with the v1.1.4322 of the .NET Framework, in Window2K server"). First of all, here are the two methods I have used in order to apply the sorting property to the DataView 1. Simply defining the sort order and colum DataView...
1
4623
by: Arthur Dzhelali | last post by:
I according to MSDN dataview and dataset are thread safe for read operations, but we run into this scenario. I just would like to see some comments on it. Aplication written in VB.NET it is an ASP.NET app. located on busy web server. Initially we defined dataview slightly wrong and run into the problem. we have dataset cached which has large ammount of data.
4
1540
by: Martin Schmid | last post by:
I am trying to implement a DataView for a DataGrid so I can sort at runtime by clicking on column headers. My initial page load works... it displays the data However, when I click a column heading at run time, the data doesn't sort as expected, in fact, the DataGrid becomes empty, all I see are column headings: SqlConnection sqlConnection; protected System.Web.UI.WebControls.DataGrid DataGrid1; protected ProjContMan.dsProjByDate...
2
1648
by: scott | last post by:
Hi all, Iv got a slight problem with a datagrid and the ability to only display certain things in it. I have a Data grid which is connected to a data table. The data table is connected to a data set which in turn gets its info from
0
741
by: grolms | last post by:
I must recreated dataview . I am in the designer insert dataview set datasource ... And I set before DataBind datasource on the dataview ... How I recreated dataview. I have dataview in class member ... thanx >-----Original Message-----
2
2305
by: Ryan Moore | last post by:
I have a dataset (called adset) which has a column called "Large" which is either an integer 0 or 1. I am creating 2 dataviews, one which should display the 1's and one which should display the 0's using the following code: DataView largeview = new DataView(); largeview.RowFilter = "Large=1"; largeview.Table = adSet1.Tables; DataView smallview = new DataView();
36
4485
by: kjvt | last post by:
Based on a prior posting, I've written a function to convert a recordset to a dataview. The first call to the function for a given recordset works perfectly, but the second call always returns a dataview with a count = 0. Can someone explain why and how I might work around this problem? Here is the code for my function: Public Shared Function GetViewFromRS(ByVal pRS As ADODB.Recordset) _ As DataView
5
8835
by: David Wender | last post by:
I want to create a dataview with a sort on multiple columns. However, when I use FindRows, I only want to search some of the columns, not all. Is this possible? I have not been able to make it happen. Dim objKeys(2) as Object objKeys(0) = "CL" objKeys(2) = 4000 Dim posView As DataView = New DataView(posDS.Tables("Positions"), _
4
4837
by: Simon Verona | last post by:
Normally Google is my friend, but I can't seem to work this one out. I'm sure it's really simple as well. I normally create a dataview from a table within a dataset using the ..defaultdataview method of the table (eg dv=ds.tables(0).defaultdataview) I want to create a dataview that is limited to only certain columns of the datatable. Anybody got a quick example to get me going?
0
9722
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
9603
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
10378
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...
0
10121
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7664
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
5550
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...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3862
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.