473,651 Members | 2,582 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dataview sort not working

Hi group,

I've got this, a dataset which contains
ds.tables(0).ro ws(0).item(0) = "HO"
ds.tables(0).ro ws(1).item(0) = "L1"
ds.tables(0).ro ws(2).item(0) = "L2"
ds.tables(0).ro ws(3).item(0) = "O1"
ds.tables(0).ro ws(3).item(0) = "BR"

then I want to sort it using a dataview like this:

Dim dv As New DataView(ds.Tab les(0))
dv.Sort = dv.Table.Column s(0).ColumnName
'also tried dv.sort = "col1" 'col1 is the name of the column in the select
statement

but after the dv.sort, dv.table.rows(3 ).item(0) still is "BR", but "BR"
should have become the first row, so I'm doing something wrong but I don't
no what

Greetz Peter


Nov 21 '05 #1
3 5455
Figured it out, I should use a datarowview when looping the dataview
Greetz Peter

"Peter Proost" <pp*****@nospam .hotmail.com> schreef in bericht
news:ui******** ******@TK2MSFTN GP12.phx.gbl...
Hi group,

I've got this, a dataset which contains
ds.tables(0).ro ws(0).item(0) = "HO"
ds.tables(0).ro ws(1).item(0) = "L1"
ds.tables(0).ro ws(2).item(0) = "L2"
ds.tables(0).ro ws(3).item(0) = "O1"
ds.tables(0).ro ws(3).item(0) = "BR"

then I want to sort it using a dataview like this:

Dim dv As New DataView(ds.Tab les(0))
dv.Sort = dv.Table.Column s(0).ColumnName
'also tried dv.sort = "col1" 'col1 is the name of the column in the select statement

but after the dv.sort, dv.table.rows(3 ).item(0) still is "BR", but "BR"
should have become the first row, so I'm doing something wrong but I don't
no what

Greetz Peter

Nov 21 '05 #2
Peter,
That is exactly right, the dable to which the dataview is connected should
show you that.
dv.table.rows(3 ).item(0) "BR"
The dataview
dv(3)(3).ToStri ng should give you "L2" or something

I hope this helps?

Cor

Nov 21 '05 #3
Hi Cor,

that's exactly what it does, but if you've had a headache all day and then
bump your head on a closet, you're thinking isn't that clear anymore ;-)
that's why I didn't found it sooner

thanks for the help

Greetz Peter

"Cor Ligthert" <no************ @planet.nl> schreef in bericht
news:e5******** *****@TK2MSFTNG P12.phx.gbl...
Peter,
That is exactly right, the dable to which the dataview is connected should
show you that.
dv.table.rows(3 ).item(0) "BR"
The dataview
dv(3)(3).ToStri ng should give you "L2" or something

I hope this helps?

Cor


Nov 21 '05 #4

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

Similar topics

9
2575
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...
9
2088
by: Raymond Lewallen | last post by:
I have a dataview in which the sort property will not sort the dataview. Here's is a simple scenario similar to what I am doing: Class Foo Private Function Retrieve() As DataView ' Returns a DataView with 2 columns and 3 rows Dim ADOHelper As New DAL.ADOHelper Return ADOHelper.GetMyDataview() End
1
3143
by: saima ashraf | last post by:
Hi, I am trying to sort the data in my crystal report at runtime. The problem is that i can only query the database once and that is at the loading of the report. At that time i fill up my dataset. Afterwards when the sorted data is required, i use the Dataview's sort method and sort the data. This sorted data is perfectly shown in the datagrid. Now i want this data to be shown in my crystal report object too. Its not working!!! Can...
3
3447
by: nish | last post by:
Hi, I have been working on Sorting within a Datagrid that is created programmatically, so everything is created in the code-behind. I have a Template Column that consists of a Header Template. The Header Template consists of LinkButtons, so when triggered it will fire an event calling the following function: e.CommandName - contains "Sort1", "Sort2", etc.
4
2610
by: Aaron Smith | last post by:
Dim dv As DataView = New DataView(FacilitiesDS1.Facilities, "", "ID ASC", DataViewRowState.CurrentRows) Dim iPos As Integer = dv.Find(dr.Item("ID")) Me.BindingContext(FacilitiesDS1, "Facilities").Position = iPos That is the code.. dr is DataRow. If dr.Item("ID") = 3, the find will return position 0, which it should have been 1, and if the ID = 2, it will return 1, which should have been 0.. The DA has a connection string that sorts it...
0
1835
by: Nathan Franklin | last post by:
Hello Guys, I have been trying to work this our for so long, but I just can't seem to find the answer. I am loading a datatable from a an access database using an oledbdataadapter. I then assign the datatable.dataview to my datagrid.datasource member so it will display my results.. I need to give the user an option to change the order of this data, I have a
1
1770
by: Islamegy® | last post by:
I have 2 Questions.. 1- Is it better to use Dataview To filter and sort Datatables or requery the datasource?? When i was working in windows appl i found sorting and filtering on client old machine is slow and need proccessor usage now in asp.net the load is centralized on the web Server, what is the best way for filter/sort data?? 2- In case i will use view sort/filter, I'm working with strong type collections.. so i'm tring to mimic...
0
8347
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
8275
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
8792
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...
1
8457
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
7294
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...
0
4143
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
4280
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2696
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
1585
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.