Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Add more conditions
Message
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
LINQ
Titre:
Add more conditions
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01577042
Message ID:
01577042
Vues:
38
Hi everybody,

I am wondering what is the correct syntax. I have declared a query variable like this
EnumerableRowCollection<DataRow> query;
               if (checkType && checkCategory)
                  query = from c in dtMax4SaleLimits.AsEnumerable()
                          where ((2 == c.Field<Byte>("type") && lsn_cat == c.Field<String>("lsn_cat"))
                          || (3 == c.Field<Byte>("type") && lessontype == c.Field<Int32>("lessontype")))
                          && (c.Field<DateTime?>("start_time") < ending_time &&
                              c.Field<DateTime?>("end_time") > begin_time)
                          select c;
I actually need to do it without the last condition for dates first and get the count. Then, if the count is greater than 0 I will run a loop and add extra conditions for time (time condition is the same, but ending_time and begin_time variables change).

Do you see what I mean? Can you have to formulate it correctly?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Répondre
Fil
Voir

Click here to load this message in the networking platform