I want to search between 2 dates , and also another search between 2 times

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<img alt="" src="http://social.msdn.microsoft.com/Forums/getfile/109090
<pre class="prettyprint lang-vb Search
Static m As Integer = 0
Static: Specifies that one or more declared local variables are to remain in existence and retain their
latest values after termination of the procedure in which they are declared
If ComboBox1.Text = Trim("") Then Exit Sub
If text box empty end function
Dim time1 As String
If ComboBox1.Text = "" And ComboBox2.Text = "" Then
time1 = "00:00:00"
Else
time1 = (ComboBox1.Text) + ":" + (ComboBox2.Text) + ":00"
End If
Dim time2 As String
If ComboBox3.Text = "" And ComboBox4.Text = "" Then
time2 = "00:00:00"
Else
time2 = (ComboBox3.Text) + ":" + (ComboBox4.Text) + ":00"
End If

If ComboBox7.Text = "الكل" Then
ComboBox7.Text = "مهم" Or ComboBox7.Text = "عادي"
Else
End If

Dim Date1 As String
Date1 = (" + DateTimePicker1.Value + ", dd/mm/yyyy HH:mm:ss)
+ " 00:00:00"
Dim Date2 As String
Date2 = DateTimePicker2.Value + " 23:59:59"
For التواريخ
SQLstr = "SELECT * FROM ALLEvents WHERE الوقت <= (" & DateTimePicker1.Text & ", yyyy/mm/dd) AND الوقت >= (" & DateTimePicker2.Text & ", yyyy/mm/dd)"
SQLstr = "SELECT * FROM ALLEvents WHERE الوقت BETWEEN (" + DateTimePicker1.Value + ", dd/mm/yyyy HH:mm:ss) And (" + DateTimePicker2.Value + ", dd/mm/yyyy HH:mm:ss) " ORDER BY الوقت DESC ) WHERE الأهمية LIKE %" & CheckBox1.Text & "% ORDER BY الوقت DESC "
SQLstr = "SELECT ALLEvents.* FROM ALLEvents WHERE (((ALLEvents.الوقت) Between #" + DateTimePicker1.Value + "# And #" + DateTimePicker2.Value + "#)) ;" Gooooood
SQLstr = "SELECT TOP 30 * FROM (SELECT ALLEvents.* FROM ALLEvents WHERE ((ALLEvents.الوقت) Between #" + DateTimePicker1.Value + "# And #" + DateTimePicker2.Value + "#) ; ) WHERE الأهمية LIKE %" & CheckBox1.Text & "% ORDER BY الوقت DESC "
SQLstr = "SELECT ALLEvents.* FROM ALLEvents WHERE (((ALLEvents.الوقت)>=#" + DateTimePicker1.Value + "#) and ((ALLEvents.الوقت)<#" + DateTimePicker2.Value + "1 #));"
SQLstr = "SELECT ALLEvents.* FROM ALLEvents WHERE ((ALLEvents.الوقت) Between #" + DateTimePicker1.Value + "# And DateAdd(""d"",1, #" + DateTimePicker2.Value + "#)); "
SQLstr = "SELECT ALLEvents.* FROM ALLEvents WHERE (((ALLEvents.الوقت) Between DateValue(#" + DateTimePicker1.Value + "#) And DateValue(#" + DateTimePicker2.Value + "#))) ;" Gooooood
SQLstr = "SELECT ALLEvents.* FROM ALLEvents WHERE (((ALLEvents.الوقت) Between #" + DateTimePicker1.Value + "# And #" + DateTimePicker2.Value + "#)) ;" Goooooood
SQLstr = "SELECT * FROM ALLEvents WHERE (((الوقت) Between #" + DateTimePicker1.Value + "# And #" + DateTimePicker2.Value + "#)) ;"
SQLstr = "SELECT * FROM ALLEvents WHERE ((الوقت) Between DateValue(#" + DateTimePicker1.Value + "#) And DateValue(#" + DateTimePicker2.Value + "#))"
SQLstr = "SELECT * FROM ALLEvents WHERE الوقت >= #" + Date1 + "# And الوقت <= #" + Date2 + "# "
Select MyDate FROM tbl WHERE MyDate Between #2/5/2006 14:7:0# And #11/18/2006 17:28:15#[/code]
Any one can help in using search between 2 dates ?
and Also statment to search between 2 Times. <hr class="sig adelr5@yahoo.com

View the full article
 
Back
Top