Hello,
I'me trying to select the records that are on the database with the field 'Data" between two dates that are inserted into two fields: "DeData" and "aData". I've the following code but I'm getting an error on my SQL statment:
Can annyone help me please?
Thanks,
João Pinto
I'me trying to select the records that are on the database with the field 'Data" between two dates that are inserted into two fields: "DeData" and "aData". I've the following code but I'm getting an error on my SQL statment:
Code:
Private Sub DeData_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DeData.ValueChanged
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=""C:\Programaçao\Visual Basic\Inapal\ReportIt\ReportIt.mdb"";"
con.Open()
sSQL = "SELECT * FROM [RelatorioQuery] WHERE ((Data >'#" & DeData.Text & "#') AND (Data <'#" & aData.Text & "#')) AND (Descriçao LIKE'%" & SearchBox.Text & "%')"
da = New OleDb.OleDbDataAdapter(sSQL, con)
ds.Clear()
da.Fill(ds, "RelatorioQuery")
DataGridView1.DataSource = ds
DataGridView1.DataMember = "RelatorioQuery"
con.Close()
End Sub
Can annyone help me please?
Thanks,
João Pinto