Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / August 2007

Tip: Looking for answers? Try searching our database.

Bug in FindRows

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SevDer - 06 Aug 2007 01:27 GMT
Hi Guys,

I have the following issue on FindRows.

Below is my simple little method
--------------
       public static DataRowView[] GetCountryDestinations(string
countryCode)
       {
           DataView filteredResults = Destionations.DefaultView;
           filteredResults.Sort = "CountryCode";
           return filteredResults.FindRows(countryCode);
       }
--------------

As you see from this code, it always adds a sort in each call of the method,
however from time to time it throws the following exception and driving me
crazy

--------------
Find finds a row based on a Sort order, and no Sort order is specified.
--------------

Can someone tell me why?

SevDer
http://www.sevder.com
Peter Duniho - 06 Aug 2007 01:44 GMT
> [...]
> --------------
> Find finds a row based on a Sort order, and no Sort order is specified.
> --------------
>
> Can someone tell me why?

If you post code that is actually the code that you are using, and it is
a complete-but-concise example of code that reliably reproduces the
problem, yes...it's likely someone can tell you why.

The code sample you offer isn't nearly enough to explain the behavior,
and it even has what appears to be a typographical error.  Do you really
have a variable somewhere named "Destionations"?

Alternatively, you may find it useful to use the debugger to look at the
state of the DataView object at the time of the exception to confirm or
refute your assertion that it does in fact have a Sort order.

Also, you might want to try appending the text "ASC" or "DESC" to the
string containing the column name for the property to be valid.

For example:

    filteredResults.Sort = "CountryCode ASC";

The docs claim that there is a default (ascending order), but given the
error you're getting, maybe they are wrong and at least in some cases it
has to be included explicitly.

Pete
SevDer - 06 Aug 2007 02:11 GMT
Hi Peter,

Thanks for the information.
Code is correct, but you are right, there is a type (no compilation errors
here).
However my problem is not always. Every once in a while this error is thrown
therefore my chances for debugger is really limited as I don't know when it
will happen.
Additionally

       #region static members
       public static DataTable Countries, Destionations, Zones;
       #endregion

where this datatable is loaded in the static constructor.

By the way, I will still try your suggestion using "ASC" as a begining but I
still feel that there is a problem somewhere. (I hope my only problem is
ACS).
Thanks
SevDer
www.sevder.com

----------------------------------------------------------------------------------------------------------------------------------

>> [...]
>> --------------
[quoted text clipped - 27 lines]
>
> Pete
Peter Duniho - 06 Aug 2007 04:49 GMT
> Thanks for the information.
> Code is correct, but you are right, there is a type (no compilation
> errors here).

I would be surprised if it is true that _all_ of the code involved is
correct.  Bugs in .NET are not unheard of, but your first suspicion
should be your own code, and only when you have absolutely ruled out any
possibility of a mistake should you consider that the bug may be in .NET.

As a first step, you really need to find a minimal amount of code that
can still reproduce the error.  I suspect that you have something in
some other code that you haven't posted that is somehow interfering.
But since you haven't reduced your code to that minimal example, there's
no way for someone to help you find the error in your code.

> However my problem is not always. Every once in a while this error is
> thrown therefore my chances for debugger is really limited as I don't
> know when it will happen.

Then you need to just keep testing it until you get the error.  These
kinds of bugs are harder to debug, but they are not impossible.  It just
takes some patience and some persistence.

> Additionally
>
[quoted text clipped - 3 lines]
>
> where this datatable is loaded in the static constructor.

I thought you said "Destionations" was a typo?

Pete
Linda Liu [MSFT] - 06 Aug 2007 08:28 GMT
Hi SevDer,

I performed a test based on your sample code but couldn't reproduce the
problem in my test.

It's hard to address this problem if I couldn't reproduce it. If possible,
could you please create a simple sample project that could just reproduce
the problem and send it to me?

To get my actual email address, remove 'online' from my displayed email
address.

Thank you for your understanding and cooperation!

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Linda Liu [MSFT] - 08 Aug 2007 11:24 GMT
Hi SevDer,

How about the problem now?

If the problem is still not solved, please feel free to let me know.

Thank you for using our MSDN Managed Newsgroup Suppor Service!

Sincerely,
Linda Liu
Microsoft Online Community Support
Steven Cheng[MSFT] - 08 Aug 2007 11:56 GMT
Hi SevDer,

Have you got any progress on this? If you would, please feel free to send a
simplified repro package to us so that we can help you do some further
research on this.

Looking forward to your response.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.