Re: Options for DataTable string comparisons

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Bill Menees (Bill_at_NoSpam.com)
Date: 11/03/04


Date: Wed, 3 Nov 2004 07:07:08 -0600

Yes, that is the correct interpretation of the issue: ignoring trailing
whitespace in key comparisons should be optional.

I'm aware that DataTable behaves like SQL Server, but DataTable should be
more generic than that. SQL Server's whitespace handling rules are
different from other databases' rules (e.g., Oracle). Since .NET supports
Oracle access, DataTable ought to be able to handle key comparisons in an
Oracle-compatible way too. (FWIW, I don't like Oracle, but I have to
support it because some of my clients use it.)

I used the Reflector utility to decompile several System.Data classes and
ultimately tracked the trailing whitespace logic back into the internal
DataTable.Compare method. It always ignores trailing spaces, but it should
be very simple to allow each DataColumn to specify whether or not trailing
spaces should be ignored. It can easily be done as a non-breaking change if
DataColumn exposes a new read/write bool property that defaults to the
current "ignore" behavior. (I mention that it would be a non-breaking
change because I'm sure the .NET 2.0 API is pretty close to being locked
down...)

Thanks for your response and for forwarding this to the correct group,

Bill



Relevant Pages

  • Re: I want to KEEP trailing zeros
    ... If he uses, the decimal or numeric Sql Server datatype, how do you suggest ... Dacon Software Consulting ... technicians need to record numbers with varying scale and precision. ... with a good way to save trailing zeros. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: [OT] Vim highlighting for trailing spaces
    ... >> And for vim trailing space, ... > It always displays trailing whitespace and spaces-before tabs... ... want to use pattern below to also highlight "tab after space" in the ...
    (Linux-Kernel)
  • Re: DataTable.Select Method bug?
    ... it with sql server enterprise manager, then i can add a trailing blank at ... ignores the trailing blanks. ... one row contains 'Adrian ', but I want only the row ... We use the Select-Method of the DataTable class to retriev data. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: RFC: Trailing blanks in source files
    ... > | notification that it is happening so if for some reason you ... > | do want trailing whitespace you could abort or override. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: [patch] zaurus family: battery cleanups
    ... This patch has a number of checkpatch errors. ... Mostly trailing ... whitespace, or just spacing issues.. ...
    (Linux-Kernel)