【问题标题】:CurrentDateTime() in EFEF 中的 CurrentDateTime()
【发布时间】:2023-04-07 02:20:01
【问题描述】:

我用这段代码来获取服务器日期但我真的不明白。CreateDateTime()不是一个sql函数。那么它是什么?

DateTime ServerDate = Entities.CreateQuery<DateTime>("CurrentDateTime()").AsEnumerable().First();

我觉得CreateQuery函数里面的字符串一定是sql查询,是不是错了?

我打开 SSMS 并写入 CurrentDateTime(),但出现错误,我也对此进行了测试:SELECT CurrentDateTime(),但又出现错误,CurrentDateTime() 不是 sql 函数

【问题讨论】:

标签: c# sql-server entity-framework


【解决方案1】:

CurrentDateTime() 是实体 SQL 的 Date and Time Canonical Functions 之一。

【讨论】:

  • 它调用GetDate函数?
猜你喜欢
  • 1970-01-01
  • 2012-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-15
  • 2019-01-21
  • 1970-01-01
相关资源
最近更新 更多