还可以: 1.用Web Service 公开一个GetServerTime方法,返回服务器时间; 2.用Remoting,服务器端实现一个提供时间的服务(类似于做成一个简单的时间服务器);
DateTime dt = DateTime.Now;
to jn_sly(孤舟) select getdate() 怎么用?可以详细点吗?
Web Service我还不会用,CS结构的怎么做呀?sql数据库。select getdate()嵌入出错this.comm = new System.Data.SqlClient.SqlCommand("select getdate() from table", this.sqlConnection1); this.sqlConnection1.Open(); this.textBox1.Text = comm.ExecuteReader().ToString();
如果是用数据库可以这样了create proc getdatetime @datetime datetime output as select @datetime = getdate() go 当然也可以用: select top 1 getdate() from sysobjects 说明:只用select getdate() 是返回不了数据的,你可以从一个肯定有数据的表中取这样就可以了
可以如下:
select getdate()
1.用Web Service 公开一个GetServerTime方法,返回服务器时间;
2.用Remoting,服务器端实现一个提供时间的服务(类似于做成一个简单的时间服务器);
this.sqlConnection1.Open();
this.textBox1.Text = comm.ExecuteReader().ToString();
@datetime datetime output
as
select @datetime = getdate()
go 当然也可以用:
select top 1 getdate() from sysobjects
说明:只用select getdate() 是返回不了数据的,你可以从一个肯定有数据的表中取这样就可以了