79327410

Date: 2025-01-03 18:57:45
Score: 0.5
Natty:
Report link

This would work just fine if you were passing in numeric values, but you are passing in strings within a SQL statement for your varchar arguments. Where are your quotation marks?

string Item1 = "123";
DateTime Item2 = DateTime.Now.AddDays(-3);
DateTime Item3 = DateTime.Now;

var result = await context.Set<string>().FromSqlInterpolated
            ($"EXECUTE proc @item1='{Item1}', @item2='{Item2.ToString()}', @item3='{Item3.ToString()}'")
            .FirstOrDefaultAsync();
Reasons:
  • Has code block (-0.5):
  • Ends in question mark (2):
  • High reputation (-1):
Posted by: Xavier J