I take it the dates are stored as dates in the database? If that is correct, then the parameter should also be a date.
Try converting the text into a datetime first and then use the value as parameter. In other words
...
DateTime startdate;
DateTime enddate;
if (!DateTime.TryParse(start.Text, out startddate)) {
}
if (!DateTime.TryParse(end.Text, out enddate)) {
sqladapt.SelectCommand.Parameters.AddWithValue("@startyear",startdate)
sqladapt.SelectCommand.Parameters.AddWithValue("@endyear", enddate)
...
Also you can set the data type of the parameter when adding the parameter. See
OleDbParameterCollection.Add Method (String, OleDbType) (System.Data.OleDb)[
^]
ADDITION:
---------
VB version
Dim startdate As DateTime
Dim enddate As DateTime
If (Not DateTime.TryParse(start.Text, startdate)) Then
End If
If (Not DateTime.TryParse(end.Text, enddate)) Then
End If
sqladapt.SelectCommand.Parameters.AddWithValue("@startyear", startdate)
sqladapt.SelectCommand.Parameters.AddWithValue("@endyear", enddate)