command between

Markoleo

Member
Joined
Aug 5, 2006
Messages
19
Programming Experience
Beginner
Dim cs As String = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source=c:\database.mdb;Jet OLEDB:database Password= 1"

Dim ad4 As New OleDb.OleDbDataAdapter("select * from table where date BETWEEN '" & CDate(TextBox1.Text) & "' and '" & CDate(TextBox2.Text) & "' ", cs)


"Data type mismatch in criteria expression!"

i don't no, what is problem with this.


Dim time As TimeSpan

TextBox1.Text = CDate(System.DateTime.Today)
TextBox2.Text = CDate(System.DateTime.Today + System.TimeSpan.FromDays(20))
 
You should use "/" instead of "." and the date format may be is "MM/dd/yyyy".

dateformat in database is short date(19.6.2007)



select * from letovi where Date BETWEEN '/ & CDate(TextBox1.Text) & /' and '/ & CDate(TextBox2.Text) & /'



again

"Data type mismatch in criteria expression!"
 
Back
Top