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