Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.Odbc
Public Class Form1
Public Function ServerTime()
On Error Resume Next
Dim myTime As Date
Dim conn As New OdbcConnection
conn.ConnectionString = strConnectionString
conn.Open()
Dim cmd As New OdbcCommand("SELECT GETDATE() AS CurrentDateTime", conn)
Dim rs As OdbcDataReader
rs = cmd.ExecuteReader()
Dim i As Integer = 0
While rs.Read
myTime = rs("CurrentDateTime")
End While
Return myTime
Exit Function
End Function
end Class
ไม่มีความคิดเห็น:
แสดงความคิดเห็น