使用linq时怎么获得服务器时间 本帖最后由 jsz44 于 2010-12-09 17:33:41 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 getdate()函数应该有在Linq中映射才对,你找下,所有SQLSERVER的函数都可以映射到Linq的实体类中的。 [Function(Name = "GetDate", IsComposable = true)] public DateTime GetDate() { MethodInfo mi = MethodBase.GetCurrentMethod() as MethodInfo; return (DateTime)this.ExecuteMethodCall(this, mi, new object[] { }).ReturnValue; } [Function(Name = "Reverse", IsComposable = true)] public string Reverse(string str) { MethodInfo mi = MethodBase.GetCurrentMethod() as MethodInfo; return (string)this.ExecuteMethodCall(this, mi, new object[] { str }).ReturnValue; } 使用这方法解决了。 在服务器上建个视图 Systimeselect getdate() as Now拉到DataContext中 将以方法形式出现访问时:DataContext.Systime.First().Now 我在UpdataPanel控件中使用Timer控件实现局部刷新,想通过点击textbox控件停止Timer控件功能,怎么不行? winform程序用post调用Java提供的接口问题 高手帮帮忙解答C#表格问题~~ C#可否将结构体数组传给数据库,ORACLE 做一个小小的考试系统,求大神帮帮忙怎么写自动改卷那部分代码啊? 问一个magicAjax问题 关于DataGridView的分页和ComBobox绑定! 关于socket的问题 给个小的在Form中使用数据库的例子好么(40) 请问如何遍历comboBox中的item C# double比较 数据库图片存取
public DateTime GetDate()
{
MethodInfo mi = MethodBase.GetCurrentMethod() as MethodInfo;
return (DateTime)this.ExecuteMethodCall(this, mi, new object[] { }).ReturnValue; } [Function(Name = "Reverse", IsComposable = true)]
public string Reverse(string str)
{
MethodInfo mi = MethodBase.GetCurrentMethod() as MethodInfo;
return (string)this.ExecuteMethodCall(this, mi,
new object[] { str }).ReturnValue;
} 使用这方法解决了。
select getdate() as Now
拉到DataContext中 将以方法形式出现
访问时:DataContext.Systime.First().Now