如题,我的远程服务器数据库采用的是SQL SERVER 2005。该如何实现?

解决方案 »

  1.   

    #region 获取服务器时间
            public static DateTime GetServerTime()
            {
                SqlConnection con = GetConn();
                SqlCommand com = new SqlCommand("select getdate()", con);
                con.Open();
                DateTime time = (DateTime)com.ExecuteScalar();
                con.Close();
                return time;
            }        public static string GetServerTimeStr()
            {
                SqlConnection con = GetConn();
                SqlCommand com = new SqlCommand("select getdate()", con);
                con.Open();
                DateTime time = (DateTime)com.ExecuteScalar();
                con.Close();
                return time.ToString("yyyyMMddhhmmssff");
            }
            #endregion