vb.net 同步服务器时间

                'claOpt是我自定义的一个数据库连接读取类

     ''提示同步服务器时间。Modify By Liu Sg On 2010-07-06
                Dim sql As String = "select ServerDateTime=getdate() "
                Dim sServerDT As String = claOpt.ExecSqlScalar(sql)       '得到数据库服务器时间
                Dim sLocalDT As String = Now.ToString                            '得到本地时间
                If sServerDT.Trim <> sLocalDT.Trim Then                         '判断是否一样
                    If MsgBox("Local time and server time is not uniform," & Chr(13) & "It may make the system not work correctly," & Chr(13) & "Do you want unity as the server time[" & sServerDT & "]?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then               '提示是否更新时间.

                       ' '为了防止客人没有看到提示,或提示过长时间再点确定,造成同步时间不准确,这里再次新得到服务器时间.                       

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值