If i put the date as: 01/02/2011 - 01/02/2011
and data in the database looks like so:
ID Name Date
123 John
123 John 01/02/2011
124 Peter
124 Peter 10/08/2012
i would like to be able to get both these rows
123 John
123 John 01/02/2011
But as you can see one of the row does not have a date in the row, so at the moment i am not getting that row just:
123 John 01/02/2011
so what i am asking is how could i get both:
how i am filtering the dates at the moment:
Public Function mediumdate(ByVal Str As String) As String
Dim aDay As Integer
Dim aMonth As String
Dim aYear As Integer
Dim x As String = Format(Str, "dd/MM/yyyy")
aDay = DateAndTime.Day(CDate(Str))
aMonth = MonthName(DateAndTime.Month(CDate(Str)), True)
aYear = DateAndTime.Year(CDate(Str))
Return CStr(aDay & "-" & aMonth & "-" & aYear)
End Function
Function ShowTableBetweenSetDates() As DataSet
Dim ds As New DataSet()
Try
Dim ActionCode As String = "ActionCode"
If DBCon.State = ConnectionState.Closed Then
DBCon.Open()
End If
Dim rs As New ADODB.Recordset()
rs.CursorLocation = ADODB.CursorLocationEnum.adUseClient
rs.CursorType = ADODB.CursorTypeEnum.adOpenStatic
rs.LockType = ADODB.LockTypeEnum.adLockBatchOptimistic
'get the date i want from two date time pickers 'DTP1 and DPT2
rs.Open("SELECT * FROM " & working_Table & " WHERE DateActioned >= #" & _
mediumdate(CStr(frmUpdatedMainMenu.DTP1.Value)) & "# AND DateActioned <= #" & _
mediumdate(CStr(frmUpdatedMainMenu.DTP2.Value)) & "#", conString)
' close the connection
DBCon.Close()
Dim da As New System.Data.OleDb.OleDbDataAdapter()
da.Fill(ds, rs, working_Table)
Catch ex As Exception
End Try
Return ds
End Function

New Topic/Question
Reply




MultiQuote





|