Hello everyone please your help with the correct syntax of this code i´ve just build it but the visual studio has closed the session and i lost all my work
the code as you can see search between two dates that part its ok, and then search in another field of my database to validate that the information that read is the correct
how can i join up those two code
one search between two dates and the other search a value from my drop down list
Protected Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged
Dim T1 = New DateTime(Now.Year, Now.Month, Now.Day, 6, 0, 0)
Dim T2 = New DateTime(Now.Year, Now.Month, Now.Day, 14, 0, 0)
Dim T3 = New DateTime(Now.Year, Now.Month, Now.Day, 22, 0, 0)
Dim str As String
Dim con As OleDbConnection
Dim sql As String
str = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\MXDTBTZ3XC1\Users\MXDTBTZ3XC1\Desktop\CHECKLIST.accdb"
con = New OleDbConnection(str)
sql = "select * from EQUIPOS where NO_VEHICULO = '" & DropDownList2.SelectedValue.ToString & "'and DIA Between #" & TextBox2.Text & "# and #" & T1 & "#"""
Dim cmd As OleDbCommand
Dim r As OleDbDataReader
con.Open()
cmd = New OleDbCommand(sql, con)
r = cmd.ExecuteReader()
If r.Read Then
TextBox4.Text = r("PORCENTAJE_BATERIA")
End If
con.Close()
End Sub