How to filter Data in a datagrid according to date (VB.Net windows application)
In my application i want to filter Data in a datagrid according to date.
my database have one datetime field .and i want to filter data from one date to other.
This is my code. but have some error in query.
pls help. i'm confused with its syntax.
ssql = " SELECT * FROM Agreements WHERE ReturnedToOn BETWEEN '" DateTimePicker1.value.ToString()'" AND '"DateTimePicker2.value.ToString()'""
sqlda = New OleDbDataAdapter(ssql, sqlcon)
sqlds = New DataSet
sqlds.Clear()
sqlda.Fill(sqlds, "ssql")
DataGrid1.DataSource = sqlds.Tables(0)
sqlcon.Close()
# 1 Re: How to filter Data in a datagrid according to date (VB.Net windows application)
got Syntax its now Working. Thank u for Phill Weber. he indirectly helped me.
ssql = " SELECT * FROM Agreements WHERE ReturnedToOn BETWEEN #" + Convert.ToDateTime(DateTimePicker1.Value.ToString()) + "# AND #" + Convert.ToDateTime(DateTimePicker2.Value.ToString()) + "# "
# 2 Re: How to filter Data in a datagrid according to date (VB.Net windows application)
My dataset doesnt seem to filling wen I run my program. It gives me a "Data set not filled" problem. I'm using Oracle2, can you please please help. I don't know wat to do anymore i'm fustrated!!:mad: :( :confused: