Hello:
A bit old school with great intentionality. Can someone please tell me how I would return the MinDate in this function?
Thank you!
A bit old school with great intentionality. Can someone please tell me how I would return the MinDate in this function?
Code:
Private Function GetEarliestStartDate(ByVal _opcheck As String) As Date
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim sql As String = "SELECT MIN(StartDate) AS MinDate FROM Schedule " &
"WHERE WorkCenterID = '" & _opcheck.Trim & "' " &
"AND ScheduleID = '" & cboNewScheduleNo.Text & "' "
cn.Open(connectionString_Read)
rs.Open(sql, cn, CursorTypeEnum.adOpenKeyset, LockTypeEnum.adLockReadOnly)
rs.MoveFirst()
Return (rs.Fields("MinDate"))
rs.Close()
rs = Nothing
cn.Close()
cn = Nothing
End Function