Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
LINQ Query help - String vs. Char
Message
From
28/05/2008 02:16:11
 
 
To
27/05/2008 15:25:25
General information
Forum:
ASP.NET
Category:
LINQ
Miscellaneous
Thread ID:
01319768
Message ID:
01319889
Views:
13
>Just getting started with LINQ here... So, I have a table in my Linq-To-SQL where the 'status' field in the table is of type "char(1)".
>
>when I tried:
>
> where p.status == "A"
>
>
>it gave and error, and I have to use this to make it work:
>
>
>  where p.status.ToString() == "A"
>
>
>Is this right that I have to use the .ToString() method just to test against a string value? I guess what I mean is, is char(n) not a string? I must be missing something.
>
>
>
>
>            var CustomerList = from a in
>                                   (from p in db.job_info
>                                    join c in db.customers on p.cust_num equals c.custno
>                                    where p.status.ToString() == "A"
>                                    orderby c.company
>                                    select new {companyname=c.custno + "  -  " + c.company}
>                                    ).Distinct()
>                               orderby a.companyname
>                               select a;
>
Did you try:

where p.status == 'A'

"A" is a string... 'A' is a char

http://msdn.microsoft.com/en-us/library/aa691087(VS.71).aspx
http://msdn.microsoft.com/en-us/library/aa691090(VS.71).aspx
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform