473,786 Members | 2,744 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataView Sort Bug

Hi All!

I've this strange DataView sort bug and i can't do any sorting
activities! Below is my code...

---VB.NET Code---

dvFinal = New DataView(objDat aSet.Tables(CON _FinalTable))

Dim strSort As String = drpOrderBy.Text & " " & drpOrderStyle.T ext
dvFinal.Sort = strSort

Response.Write( strSort)

---End VB.NET Code---

And I got the following error...

---Error Message---

Exception Details: System.IndexOut OfRangeExceptio n: Cannot find column ASC

---End Error Message---

I don't know why DataView is treating sort expression "ASC" as the
column name!!!

Please help!!!

Thank you all in advance!!!
MK
Nov 19 '05 #1
5 4308
Have you eliminated the possibility that drpOrderBy.Text is empty?
So that what actually gets passed in is " ASC" instead of "columname ASC"

--
Regards,
Alvin Bruney [Microsoft MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ http://www.lulu.com/owc
----------------------------------------------------------
"Mike Kline" <mk@nnnnnnnnnzz zzzzzzzzzzzzzzz zzzzz.zero> wrote in message
news:Ox******** ******@TK2MSFTN GP10.phx.gbl...
Hi All!

I've this strange DataView sort bug and i can't do any sorting activities!
Below is my code...

---VB.NET Code---

dvFinal = New DataView(objDat aSet.Tables(CON _FinalTable))

Dim strSort As String = drpOrderBy.Text & " " & drpOrderStyle.T ext
dvFinal.Sort = strSort

Response.Write( strSort)

---End VB.NET Code---

And I got the following error...

---Error Message---

Exception Details: System.IndexOut OfRangeExceptio n: Cannot find column ASC

---End Error Message---

I don't know why DataView is treating sort expression "ASC" as the column
name!!!

Please help!!!

Thank you all in advance!!!
MK

Nov 19 '05 #2
Alvin Bruney [MVP] wrote:
Have you eliminated the possibility that drpOrderBy.Text is empty?
So that what actually gets passed in is " ASC" instead of "columname ASC"


Hi Alvin,

Thanks for the reply! Yes, I've eliminated that. You can see the
following code in my previous post...

Response.Write( strSort)

which indicates that I've been madly testing the value of strSort and
tried setting the dvFinal.Sort property again and again :)

Any other ideas?

Thank you!
MK
Nov 19 '05 #3
Hi Norman,

Thanks for the reply.

I've tested for example...

dvFinal.Sort="C ustomerCount ASC" and it worked fine. Only when I do
through the variable.

Also drpOrderStyle is not a DropDownList, it is a Textbox. It was named
using drp* prefix because it WAS a DropDownList but now I'm using the
TextBox. I just continued to use the same name so I don't have to change
the code while I'm in the testing phase.

Furthermore, I'm not the only one experiecing this problem (or bug???),
for example...

http://groups.google.co.nz/groups?hl...%2522DESC%2522

The thing is that I can say Response.Write( strSort) and I can see the
"CustomerCo unt ASC" appearing on the ASPX page. So why doesn't DataView
is not accepting this? Why is it treating ASC or DESC commands as column
names ?!?!?!

Thank you!

MK

Norman Yuan wrote:
Why do you hard code the column name in your code to test if it is a "bug"
(very unlikely, I bet, though), like

dvFinal.Sort="T heColumn ASC" ''TheColumn is the column you know it is
there.

Just curious: are drpOrderBy and drpOrderStyle DropDownLists in
System.Web.UI.W ebControls namespace? The way you name them indicates they
are DropDownList, but DropDownList does not have property "Text". May it be
the cause of your problem?

"Mike Kline" <mk@nnnnnnnnnzz zzzzzzzzzzzzzzz zzzzz.zero> wrote in message
news:eH******** ******@TK2MSFTN GP15.phx.gbl...
Alvin Bruney [MVP] wrote:
Have you eliminated the possibility that drpOrderBy.Text is empty?
So that what actually gets passed in is " ASC" instead of "columname


ASC"
Hi Alvin,

Thanks for the reply! Yes, I've eliminated that. You can see the
following code in my previous post...

Response.Writ e(strSort)

which indicates that I've been madly testing the value of strSort and
tried setting the dvFinal.Sort property again and again :)

Any other ideas?

Thank you!
MK


Nov 19 '05 #4
Why do you hard code the column name in your code to test if it is a "bug"
(very unlikely, I bet, though), like

dvFinal.Sort="T heColumn ASC" ''TheColumn is the column you know it is
there.

Just curious: are drpOrderBy and drpOrderStyle DropDownLists in
System.Web.UI.W ebControls namespace? The way you name them indicates they
are DropDownList, but DropDownList does not have property "Text". May it be
the cause of your problem?

"Mike Kline" <mk@nnnnnnnnnzz zzzzzzzzzzzzzzz zzzzz.zero> wrote in message
news:eH******** ******@TK2MSFTN GP15.phx.gbl...
Alvin Bruney [MVP] wrote:
Have you eliminated the possibility that drpOrderBy.Text is empty?
So that what actually gets passed in is " ASC" instead of "columname ASC"


Hi Alvin,

Thanks for the reply! Yes, I've eliminated that. You can see the
following code in my previous post...

Response.Write( strSort)

which indicates that I've been madly testing the value of strSort and
tried setting the dvFinal.Sort property again and again :)

Any other ideas?

Thank you!
MK

Nov 19 '05 #5
Problem solved. It was just my stupid coding error.

Thank you all for your time!!!

Cheers,
MK

Norman Yuan wrote:
Why do you hard code the column name in your code to test if it is a "bug"
(very unlikely, I bet, though), like

dvFinal.Sort="T heColumn ASC" ''TheColumn is the column you know it is
there.

Just curious: are drpOrderBy and drpOrderStyle DropDownLists in
System.Web.UI.W ebControls namespace? The way you name them indicates they
are DropDownList, but DropDownList does not have property "Text". May it be
the cause of your problem?

"Mike Kline" <mk@nnnnnnnnnzz zzzzzzzzzzzzzzz zzzzz.zero> wrote in message
news:eH******** ******@TK2MSFTN GP15.phx.gbl...
Alvin Bruney [MVP] wrote:
Have you eliminated the possibility that drpOrderBy.Text is empty?
So that what actually gets passed in is " ASC" instead of "columname


ASC"
Hi Alvin,

Thanks for the reply! Yes, I've eliminated that. You can see the
following code in my previous post...

Response.Writ e(strSort)

which indicates that I've been madly testing the value of strSort and
tried setting the dvFinal.Sort property again and again :)

Any other ideas?

Thank you!
MK


Nov 19 '05 #6

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

Similar topics

9
2589
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
2101
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
7
2331
by: Jason | last post by:
Is it possible to somehow sort a dataview, all on one column, but on different variables? That is, I have a 'Title' column in my dataview and I'd like to display first all "Directors" (sorted), then everyone else (sorted). I've used the 'ItemBound' but can't figure out how to do this with that procedure. Thanks in advance, any ideas are appreciated. Jason
1
1773
by: troyblakely | last post by:
I am having trouble sorting a datagrid. I have read numerous posts on this and other lists, and tried most of the suggestions, but none of them have worked for me yet. I populate a dataset from two queries, then I want to sort the data and bind it to a datagrid. Regardless of what I have tried, the datagrid is populated with the unsorted data. Any assistance you have would be appreciated. I have attempted the sort using the dataview.sort...
5
8834
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"), _
0
9650
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
10363
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
10110
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
9962
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
8992
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
7515
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
6748
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
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2894
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.