PC Review


Reply
Thread Tools Rate Thread

Compatibility reasons ...

 
 
Jacek Jurkowski
Guest
Posts: n/a
 
      1st Jul 2008
How to make it in c#:

if("20080101" < "20080201")
{
do somethink...
}

All dates in my old application (VFP/SQL) are Char 8.
For compatibility reasons i have to keep that
way but how to work with that in c#? F.e. how to use Linq?

var query = from K_PEOPLES in DC.PEOPLES_TABLE where PEOPLES.BITRHDAY <
(???) SELECT PEOPLES;

I don't want to convert string to DateTime every time ...

 
Reply With Quote
 
 
 
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      1st Jul 2008
On Jul 1, 9:24*am, "Jacek Jurkowski" <jjurkow...@data-comp.eu> wrote:
> How to make it in c#:
>
> if("20080101" < "20080201")
> {
> * * do somethink...
>
> }
>
> All dates in my old application (VFP/SQL) are Char 8.
> For compatibility reasons i have to keep that
> way but how to work with that in c#? F.e. how to use Linq?
>
> var query = from K_PEOPLES in DC.PEOPLES_TABLE where PEOPLES.BITRHDAY <
> (???) SELECT PEOPLES;
>
> I don't want to convert string to DateTime every time ...


Well, you could use String.CompareTo:

if("20080101".CompareTo("20080201") < 0)

I wouldn't like to say whether that will translate nicely into SQL,
admittedly...

Jon
 
Reply With Quote
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      1st Jul 2008
Using the cast operator, it converts just fine on SQL Server. Other DBs
might handle it different, though.

--
- Nicholas Paldino [.NET/C# MVP]
- (E-Mail Removed)

"Jon Skeet [C# MVP]" <(E-Mail Removed)> wrote in message
news:679379f7-4b2d-4755-b37b-(E-Mail Removed)...
On Jul 1, 9:24 am, "Jacek Jurkowski" <jjurkow...@data-comp.eu> wrote:
> How to make it in c#:
>
> if("20080101" < "20080201")
> {
> do somethink...
>
> }
>
> All dates in my old application (VFP/SQL) are Char 8.
> For compatibility reasons i have to keep that
> way but how to work with that in c#? F.e. how to use Linq?
>
> var query = from K_PEOPLES in DC.PEOPLES_TABLE where PEOPLES.BITRHDAY <
> (???) SELECT PEOPLES;
>
> I don't want to convert string to DateTime every time ...


Well, you could use String.CompareTo:

if("20080101".CompareTo("20080201") < 0)

I wouldn't like to say whether that will translate nicely into SQL,
admittedly...

Jon


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: 10 Reasons Why PHP is Better than ASP Toby A Inkster Microsoft ASP .NET 20 17th Jan 2008 04:22 PM
Testing Reverse Compatibility and Compatibility in General dim Microsoft Excel Misc 4 8th Jan 2008 01:02 PM
Reasons not to use MS DNS ? Marlon Microsoft Windows 2000 DNS 7 4th Aug 2005 01:24 AM
Top ten reasons open-source zealot Windows XP Basics 0 25th Nov 2004 06:30 AM
Reasons to use dot net rj Microsoft Dot NET Framework 3 30th Jun 2004 12:40 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:03 PM.