Function Sqlser_time() As Date '获得SQL服务器时间
Dim cnn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rst As New ADODB.Recordset
cnn.ConnectionString = "driver={SQL Server};" & _
"server=SER;uid=sa;pwd=a123;database=master"
cnn.Open
cmd.ActiveConnection = cnn
cmd.CommandText = "SELECT GETDATE() AS sys_Sqlser_time"
Set rst = cmd.Execute
Sqlser_time = rst(0)
rst.Close
cnn.Close
End Function