Hello there,
in vb.net (it is actually web application) I would like to perform condition based on if actual selected date by user is yeserday's date or no? this the code :
-------------------------------------------------------
Dim date1 As New Date
date1 = Request.QueryString.Get("ndate")
Try
Dim objConn As New SqlConnection(strConn)
If date1.Day = (Now.Day - 1) Then
cmd = New SqlCommand( _
"SELECT l.activityID,r.ac_name,r.description FROM users_activity L INNER JOIN tblactivities R ON l.activityID=r.activityID WHERE l.Userid='" _
& Session("user") & "'" _
& " ORDER BY L.activityID", objConn)
Else
cmd = New SqlCommand( _
"SELECT l.activityID,r.ac_name,r.description FROM users_activity L INNER JOIN tblactivities R ON l.activityID=r.activityID WHERE l.Userid='" _
& Session("user") & "'" & " AND l.activityID IN (SELECT ID FROM GeneralActivities)" _
& " ORDER BY L.activityID", objConn)
End If
............. ----------------------------------------
The whole point is here If date1.Day = (Now.Day - 1) that is giving me for today's case result "0" - I mean simply I can't compare the date1 (which is selected date by user) with the yesterday date.
Regards,
Probani.
in vb.net (it is actually web application) I would like to perform condition based on if actual selected date by user is yeserday's date or no? this the code :
-------------------------------------------------------
Dim date1 As New Date
date1 = Request.QueryString.Get("ndate")
Try
Dim objConn As New SqlConnection(strConn)
If date1.Day = (Now.Day - 1) Then
cmd = New SqlCommand( _
"SELECT l.activityID,r.ac_name,r.description FROM users_activity L INNER JOIN tblactivities R ON l.activityID=r.activityID WHERE l.Userid='" _
& Session("user") & "'" _
& " ORDER BY L.activityID", objConn)
Else
cmd = New SqlCommand( _
"SELECT l.activityID,r.ac_name,r.description FROM users_activity L INNER JOIN tblactivities R ON l.activityID=r.activityID WHERE l.Userid='" _
& Session("user") & "'" & " AND l.activityID IN (SELECT ID FROM GeneralActivities)" _
& " ORDER BY L.activityID", objConn)
End If
............. ----------------------------------------
The whole point is here If date1.Day = (Now.Day - 1) that is giving me for today's case result "0" - I mean simply I can't compare the date1 (which is selected date by user) with the yesterday date.
Regards,
Probani.