0

I am tying to convert my .net framework 4.6.1 project to .net core 2.2. I have got an error "The name Sql Functions does not exists in current context".I have been searching and haven't got any answer yet.

I have tried EF class functions but this didn't solve my problem

select new ReleaseBuildDashboardDto
                    {
                        // to fix
                        DateString = SqlFunctions.StringConvert((double)
                            SqlFunctions.DatePart("m", g.Key.Value)).Trim() +"/" +
                            SqlFunctions.DateName("dd", g.Key.Value) + "/" +
                            SqlFunctions.DateName("yyyy", g.Key.Value),
                        ScheduledCount = g.Count()
                    }).ToListAsync();

  • 2
    What is the code trying to **do**? I'd strongly suggest returning dates from the database **as dates**. – mjwills Aug 07 '19 at 07:13
  • @mjwills I am just tying to use built in sql functions – Moeen Ahmed Aug 07 '19 at 07:17
  • @mjwills is correct; however, installing the relevant NuGet package probably does what you want (or at least what you've asked for): https://www.nuget.org/packages/System.Data.SqlClient/ – Paul Michaels Aug 07 '19 at 07:22

1 Answers1

0

Maybe, you need to set reference to the System.Data.Object.

OR

try adding System.Data.Entity.SqlServer namespace and see if that works better.

Kiya
  • 168
  • 1
  • 17
  • may you are looking for this ; https://stackoverflow.com/questions/21732569/sqlfunctions-stringconvert-doesnt-work-with-doubles – Kiya Aug 07 '19 at 08:29