Question Date Filteration not working properly........

vijaygpt

New member
Joined
Jan 4, 2009
Messages
2
Programming Experience
Beginner
Hi Dudes,

Front-End=VB.net (using DateTimePicker)
Back-End=MSAccess

--query written--
strSelport = "select * from inspection where insDate between #" & FormatDateTime(CDate(dtpFrom.Value), DateFormat.ShortDate) & "# and #" & FormatDateTime(CDate(dtpTo.Value), DateFormat.ShortDate) & "#"

when i input the date as '05/07/2008' to '19/12/2008', the retrieved result shows from '07/05/2008' to '19/12/2008'
If i change the date format in regional setting as dd/MMM/yyyy', then retrieved result is correct....
Is there any way so that without changing regional setting i can retireve correct result.

b'Rgds,
V'jay
 
Use a parameterized query. Read the PQ link in my signature. The way you wrote your SQL here.. never write an SQL in that way again
 
Use a parameterized query. Read the PQ link in my signature. The way you wrote your SQL here.. never write an SQL in that way again

Thnks dude........it worked by converting the datetimepicker value to string. Also, frm now onwards will pass the parameters to execute query..
 
Back
Top