Compatibility reasons ...

  • Thread starter Thread starter Jacek Jurkowski
  • Start date Start date
J

Jacek Jurkowski

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 ...
 
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
 
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 address removed)

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top