获得SQL服务器时间的VB代码
文章作者 100test 发表时间 2007:12:21 11:47:23
来源 100Test.Com百考试题网
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