C# 如何在LinqPad中获取服务器时间

C# 如何在LinqPad中获取服务器时间,c#,linqpad,C#,Linqpad,在普通C#程序中,您可以执行以下操作: DateTime ServerDate = Entities.CreateQuery<DateTime>("CurrentDateTime()").AsEnumerable().First(); DateTime ServerDate=Entities.CreateQuery(“CurrentDateTime()”).AsEnumerable().First(); 在LinqPad环境中呢?谢谢。这不是一个很好的解决方案,但很有效 Conn

在普通C#程序中,您可以执行以下操作:

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

在LinqPad环境中呢?谢谢。

这不是一个很好的解决方案,但很有效

Connection.Open();
var command = Connection.CreateCommand();
command.CommandText = "select GetDate()";
command.ExecuteScalar().Dump();

这不是一个很好的解决方案,但很有效

Connection.Open();
var command = Connection.CreateCommand();
command.CommandText = "select GetDate()";
command.ExecuteScalar().Dump();

是的,如果成功了,就成功了!谢谢作为旁注,对于MySQL,需要使用“NOW()”来代替。是的,如果它能工作,它就能工作!谢谢作为旁注,对于MySQL,需要使用“NOW()”来代替。