Public Function GetDatetime() As string
On Error goto ErrorProcess
nStatus = SQL.Connect("DSN=eTrace;UID=etrace;PWD=123456")
If nStatus=0 Then
strSQL = " Select Convert(char(20),Getdate(),120) As TestDatetime "
SQL.Execute("Select Getdate() as TestDatetime")
While Not SQL.IsEOF
sDateTime = SQL.FieldByName("TestDatetime")
SQL.MoveNext
Wend
GetDatetime=Format(cdate(sDateTime),"mm-dd-yyyy hh:nn:ss")
End If
Exit Function
ErrorProcess:
GetDatetime=Format(Now(),"mm-dd-yyyy hh:nn:ss")
End Function
On Error goto ErrorProcess
nStatus = SQL.Connect("DSN=eTrace;UID=etrace;PWD=123456")
If nStatus=0 Then
strSQL = " Select Convert(char(20),Getdate(),120) As TestDatetime "
SQL.Execute("Select Getdate() as TestDatetime")
While Not SQL.IsEOF
sDateTime = SQL.FieldByName("TestDatetime")
SQL.MoveNext
Wend
GetDatetime=Format(cdate(sDateTime),"mm-dd-yyyy hh:nn:ss")
End If
Exit Function
ErrorProcess:
GetDatetime=Format(Now(),"mm-dd-yyyy hh:nn:ss")
End Function
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货