473,699 Members | 2,822 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sorting a Strong Typed Dataset

Hi, I am looking for a way to sort a strong typed dataset. It would seem the most straightforward way is to use a dataview. The only problem is when I use the dataview I seem to loose the strong typed properties from my original dataset

Anyone that can point me to an example of how to sort my dataset and maintain the use of my typed properties would be greatly appreciated

Thank,
Freeon
Nov 22 '05 #1
3 2756
Cor
Hi Freeon,

By using a dataview you are not sorting the dataset.

As it said, it is a view on the data from the dataset.

You also can use a rowfilter and that is exact what it says, a filter.

But if the problem is different tell it?

Cor
Nov 22 '05 #2
Right, I can use the .sort property change the order rows are accessed in the dataview. This works great but I loose the Strong Typed Names from the original dataset (unless I'm missing something) when I use the dataview

'************** **********
'Here is a quick sample (Unsorted)
Dim drHeader As CUnit.HeaderRo
Dim objUnits As New CUnit(Connectio nString) 'This is a Strong Typed Dataset (.xsd
objUnits.Loa

For Each drHeader In objUnits.Heade
Writeline drHeader.LK_I
Nex

'************** **********
'Now Here is the sorted example where I loose Strong Typed Properties from the Unit Datase
Dim drHeader As DataRowVie
Dim objUnits As New CUnit(Connectio nString) 'This is a Strong Typed Dataset (.xsd
objUnits.Loa

Dim dvHeader as New DataView(objUni ts.Header
dvHeader.Sort = "LK_id desc

For Each drHeader In dvHeade
Writeline drHeader("LK_ID ") 'This works but I lost the ability to use the typed property name (LK_ID)
Nex
'************** **********

The second example is 90% of what I want to do.

Just incase the 10% is not so clear this is how you access a non-typed datase
Writeline drHeader("LK_ID "
and this is how you access a typed dataset
Writeline drHeader.LK_I

I can't figure out how to sort a dataset while maintaining the typed property names. Usually I would not care, but I have allot of class' that need to be sorted a second way and don't want to rewrite all the UI translation code

Thanks in advance
Freeo

----- Cor wrote: ----

Hi Freeon

By using a dataview you are not sorting the dataset

As it said, it is a view on the data from the dataset

You also can use a rowfilter and that is exact what it says, a filter

But if the problem is different tell it

Co

Nov 22 '05 #3
Cor
Hi Freeon,

I have seen you have posted this to a lot of groups, so I do not know if you
have your answer.

The typed dataset is mostly (when we see it in this newsgroup) an
automaticly by Microsoft as a wizard build dataset.

I never saw that as a wizard for the dataview.

There should be posibilities to make your own strongly typed dataview.

Than you can do when you do it right instead of dv("myItem"), dv.myItem.

That is not something I would spent much time on.

(There are of course more posibilities using the binding context from the
dataset, but that is also something that if I need the syntax above I would
not spent to much time for)

Just my thought,

Cor

"Freeon" <an*******@disc ussions.microso ft.com> schreef in bericht
news:E1******** *************** ***********@mic rosoft.com...
Right, I can use the .sort property change the order rows are accessed in the dataview. This works great but I loose the Strong Typed Names from the
original dataset (unless I'm missing something) when I use the dataview.
'************** ***********
'Here is a quick sample (Unsorted):
Dim drHeader As CUnit.HeaderRow
Dim objUnits As New CUnit(Connectio nString) 'This is a Strong Typed Dataset (.xsd) objUnits.Load

For Each drHeader In objUnits.Header
Writeline drHeader.LK_ID
Next

'************** ***********
'Now Here is the sorted example where I loose Strong Typed Properties from the Unit Dataset Dim drHeader As DataRowView
Dim objUnits As New CUnit(Connectio nString) 'This is a Strong Typed Dataset (.xsd) objUnits.Load

Dim dvHeader as New DataView(objUni ts.Header)
dvHeader.Sort = "LK_id desc"

For Each drHeader In dvHeader
Writeline drHeader("LK_ID ") 'This works but I lost the ability to use the typed property name (LK_ID). Next
'************** ***********

The second example is 90% of what I want to do.

Just incase the 10% is not so clear this is how you access a non-typed dataset Writeline drHeader("LK_ID ")
and this is how you access a typed dataset:
Writeline drHeader.LK_ID
I can't figure out how to sort a dataset while maintaining the typed property names. Usually I would not care, but I have allot of class' that
need to be sorted a second way and don't want to rewrite all the UI
translation code.
Thanks in advance,
Freeon

----- Cor wrote: -----

Hi Freeon,

By using a dataview you are not sorting the dataset.

As it said, it is a view on the data from the dataset.

You also can use a rowfilter and that is exact what it says, a filter.
But if the problem is different tell it?

Cor

Nov 22 '05 #4

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

Similar topics

3
393
by: Alex Ayzin | last post by:
Hi, I have a column in my WinGrid, that's being populated with numeric data, but it's of String datatype(business rule requires to have these numbers as varchars in DB). On top of that, I need to be able to sort on that particular column. But because column contains character data(even though it looks like digits), the sorting is all out of whack, e.g, 1, 11, 12, 13.....2, 21, 22, so on, you got the picture.I'm using the typed dataset as...
2
325
by: Freeon | last post by:
Hi, I am looking for a way to sort a strong typed dataset. It would seem the most straightforward way is to use a dataview. The only problem is when I use the dataview I seem to loose the strong typed properties from my original dataset Anyone that can point me to an example of how to sort my dataset and maintain the use of my typed properties would be greatly appreciated Thank, Freeon
3
1855
by: paul.phillips | last post by:
Hi I have the following table (*=Primary Key): tblNews: fldID (Indentity) fldSite int * fldPageID int * fldSection int * fldContent
4
1703
by: Richard | last post by:
When i try sorting in the database, it sorts the numbers: 0 1 102 2 304 305 4 etc....
3
2441
by: Chris Thunell | last post by:
I have 2 forms, on 1 form i use the wizards to create a strong typed dataset with tables from an SQL database... and from that i can do stuff like: me.daEmployee.fill(me.dataset11.tblEmployee) plus some 3rd party controls can see it the datatables etc etc. Is there anyway when i open the second form that this information that has already been loaded into my in-memory dataset be available on all my other forms... and still be strong...
3
1251
by: Steve Amey | last post by:
Hi all I have created a strong DataSet using Visual Studio. I have been in to the DataSet's vb file to have a look at the code and see if I can add things to it. What I'm after is to create a new method on every DataTable in the DataSet, this method will be called SelectToTable, as I have the need to select rows in a current table into another table, and the Select method only returns an array of data rows. However, any changes that I...
1
2419
by: Steve | last post by:
I have a windows CE application, talking to a C# WebService. In the WebService project I have created a dataset (dsJobList), and there is a web method in there which returns a fully loaded dsJobList dataset to the client, which in this case is a windows CE device. In the code for my application on the WinCE device, I have added a Web Reference to this WebService. Once I have added it I can see the .disco, the ..wsdl and a dsJobList.xsd...
4
1757
by: Jon Paal | last post by:
I am passing an xml data file to a server control and need to sort the data. The data has three levels(tables). What is the recommended approach to do the sorting ? (using vb.net and asp.net 2.0)
7
1551
by: Peter Kirk | last post by:
Hi say I have a list of Person objects, which I want to sort. But I don't just want to sort by "name" say, but by several fields in the Person object. Maybe 1st priority by height, 2nd priority by weight, and 3rd priority by age. A Person object has many attributes though, and I want to be able to select between all of the fields for sorting (with 1st, 2nd, 3rd priority).
0
8704
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
8623
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
9192
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9054
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
8895
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...
1
6545
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...
1
3071
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2362
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2015
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.