19

Linq - no overload for method 'tostring' takes 1 arguments

 2 years ago
source link: https://www.codeproject.com/Questions/5318627/Linq-no-overload-for-method-tostring-takes-1-argum
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

See more:

Dear All

I have this query

Copy Code
aquery = (from p in ctx.rap_t009_i.Where(x => (x.d_prog <= dDat))
          join r in ctx.t011 on p.id_prog equals r.id_prog
          join s in ctx.t005 on r.id_pers equals s.id_pers
          select new TAP_UTILITY.cl_PRIVACY
          {

              c_nom = s.c_nom,
              c_cog = s.c_cog,
              c_cod = s.c_cod,
       ---->  s_date_birth =  s.d_date_birth.ToString("dd/MM/yyyy"), <-----
              c_email = s.c_email
          }).Distinct().ToList();


But this query doesn't work. I receive this error message:
Copy Code
Error	CS1501	No overload for method 'ToString' takes 1 arguments	


What I have tried:

I try with this code, but doesn't work.
Copy Code
s_date_birth = s.d_date_birth.HasValue ? s.d_date_birth.ToString("dd/MM/yyyy") : string.Empty,


How can I resolve ?

Thanks to everyone who will help me

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK