473,671 Members | 2,365 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

array of datarows to dataview

gl
What is the quickest way to get an array of datarows (from a typed dataset)
into a dataview (for the purpose of sorting to bind to a datagrid)?

Like i have a function that returns usersDataSet.us ersRow[]. I want to take
those results, put it into a dataview, and sort them. I know i could probably
loop through the results one by one, and put them into a datatable, then make
a view from the table, but is there a faster way? Thanks.

If you know any problems with that method let me know too. Thx.
Dec 19 '05 #1
2 7106
gl wrote:
What is the quickest way to get an array of datarows (from a typed dataset)
into a dataview (for the purpose of sorting to bind to a datagrid)?

Like i have a function that returns usersDataSet.us ersRow[]. I want to take
those results, put it into a dataview, and sort them. I know i could probably
loop through the results one by one, and put them into a datatable, then make
a view from the table, but is there a faster way? Thanks.

If you know any problems with that method let me know too. Thx.


From my knowledge you can only make a DataView out of a table, so in
your case you will need to create a table and put those rows in there.

But isn't it easier make that function return DataView instead of
DataRow[]?
MuZZy
Dec 19 '05 #2
I believe the tables in your DataSet each have a DefaultView property which
is a DataView. You can set the sort and filter properties you need on this
prior to using it for databinding.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"gl" wrote:
What is the quickest way to get an array of datarows (from a typed dataset)
into a dataview (for the purpose of sorting to bind to a datagrid)?

Like i have a function that returns usersDataSet.us ersRow[]. I want to take
those results, put it into a dataview, and sort them. I know i could probably
loop through the results one by one, and put them into a datatable, then make
a view from the table, but is there a faster way? Thanks.

If you know any problems with that method let me know too. Thx.

Dec 19 '05 #3

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

Similar topics

6
2669
by: rodchar | last post by:
Hey all, I have an array of data rows that when I bind it to a datagrid it shows all those extra rows in addition to my fields. How do I hide those fields? I tried using the TableStyles property but seems like it's getting overridden. Any ideas? Thanks in advance,
1
1687
by: Jason | last post by:
I've gathered a bunch of data from Active Directory and placed it into a datatable ("ADTable"). I now need to sort and filter this table based on the selection of a drop down list("ddlCategory"). How can I filter the dataview of this datatable to display those records that match (partially or fully) the value selected in the drop down list? I have the following code that doesn't work, and returns zero rows (note that 'department' is a...
5
1675
by: Geoff Jones | last post by:
Hi Suppose we have an array of DataRows e.g. Dim drMyRows() As DataRow = myTable.Rows(0).GetChildRows("PricesCompany") generated via a relationship. The question I have is this. Isn't this in essence a table i.e. a collection of rows? The reason I ask is that I wanted to extract from the array of rows
3
1615
by: astro | last post by:
I have a datagrid that is two levels down from the dataview (i.e. grandchild). I have spent 3 hours trying to get the syntax of determining it's real datasource (i.e. not it's source based on it's relationship with the dataview). argh! company ---> person --->contact
1
1380
by: irnbru irnbru | last post by:
Hi all! I got an array of datarows after a select on a datatable, I want to show the results in datagrid, but it doesnt work, do i have to create a dataview? Please help me out thank you IRNBRU *** Sent via Developersdex http://www.developersdex.com ***
6
6102
by: Niyazi | last post by:
Hi all, What is fastest way removing duplicated value from string array using vb.net? Here is what currently I am doing but the the array contains over 16000 items. And it just do it in 10 or more minutes. 'REMOVE DUBLICATED VALUE FROM ARRAY +++++++++++++++++ Dim col As New Scripting.Dictionary Dim ii As Integer = 0
7
10207
by: randy1200 | last post by:
I have an orders table. Each record in the orders table contains a customer id. I have a customer table. The primary key of each record in the customer table is the customer id. After getting a subset from the orders table, I need to take the customer ids in the orders table subset, and list each record in the customer table that has a matching customer id. If I were in t-sql, this would be an easy inner join. In this case, I get
9
9334
by: Nathan Sokalski | last post by:
I have a DataTable from which I only need a certain range of the DataRows. What I would like to do is copy a range of rows from one DataTable to a new DataTable like the following: For i As Integer = start To last table1.Rows.Add(table2.Rows(i)) Next However, the code above gives an error saying the DataRow is already used in another DataTable. Is there any easy way to copy a DataRow from one
3
5388
by: =?Utf-8?B?cG1jZ3VpcmU=?= | last post by:
I have a dataset with 3 tables -- 2 Parent tables and 1 table that is a child table of both the parents. I create a dataview on the child table and set the rowfilter to a value which filters the child based on values in both parent tables. When I edit the parent tables the edit is not reflected in the dataview.count property. How can I force the dataview to refresh following parent table edits? For example: Parent1
0
8400
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
8823
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
8602
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,...
0
8672
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
5702
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
4227
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
4412
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2058
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1814
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.