Link to home
Start Free TrialLog in
Avatar of loay
loay

asked on

select statment using vb.net and access 2000

hi
i have a table in access 2000  (empno,ampname,hiredate) and i am using vb.net forms to build the application ,,, now i want to retrive all the employees who started thier work between 2 dates i tried many select staments like below but they are  not working

com.CommandText = "select * from emp where empdate >= '" & CDate(txtDate1.Text) & "' And empdate <= '" & CDate(txtDate2.Text) &"' ;"

please how can i solve it thanx
Avatar of bman9111
bman9111

try

com.CommandText = "select * from emp where empdate >= " & CDate(txtDate1.Text) & " And empdate <= " & CDate(txtDate2.Text) &""

don't need a ; ever......

u dont need the cdate either could be

com.CommandText = "select * from emp where empdate "'" & txtDate1.Text & " And empdate <= " & txtDate2.Text  &""

ASKER CERTIFIED SOLUTION
Avatar of Rick Becker
Rick Becker
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial