Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
LINQ to datatable - how to create a variable?
Message
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01576896
Message ID:
01576946
Views:
47
>Hi everybody,
>
>I have the following VFP code which I want to convert into LINQ to DataTable query
>
>
> do case
>            case llCheckType=.t. and llCheckCat=.t.
>               lcWhereCond="((type=2 and lsn_cat="+.VFP2SQL(csrDCIInfo.lsn_cat)+;
>                  ") or (type=3 and lessontype="+.VFP2SQL(csrDCIInfo.lessontype)+"))"
>            case llCheckCat=.t.
>               lcWhereCond="type=2 and lsn_cat="+.VFP2SQL(csrDCIInfo.lsn_cat)
>            otherwise
>               lcWhereCond="type=3 and lessontype="+.VFP2SQL(csrDCIInfo.lessontype)
>            endcase
>            select *;
>               from csrMax4Sale;
>               into cursor csrDCILimits NOFILTER;
>               where start_time < ltEndTime and end_time > ltStartTime and &lcWhereCond
>
>So, I found a few links on creating LINQ to datatable such as http://forums.asp.net/t/1150810.aspx for example.
>
>My problem right now that I need to make different queries depending on my conditions.
>
>So, I was thinking of
>
>if (condition 1)
>  var query = ....
>else
>  if (condition 2)
>     var query = ...
>
>
>So, I somehow need to declare this query variable at the top to be able to re-use it. But this is a problem - I don't know how to declare it with the type. What this var query should be so I can use it in my code?
>
>Thanks a lot in advance.

No ideas?
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform