Query Help

vks.gautam1

Well-known member
Joined
Oct 10, 2008
Messages
78
Location
Chandigarh, India
Programming Experience
Beginner
Im Using vb.net & msacces.

wt i want to upload data in Datgridview. But not latest.

VB.NET:
select * from Table name where KtDate<Date

KTDT is column name contaning diffrent dates

How can i select that data which is two months back of current date.

i tried this also

select * from tablename where ktdt<dateadd(mm,-2,getdate())
but it not work.


format of date in my table is 12/04/2008 mm/dd/yyyy
 
Last edited:
I haven't used convert date.. bt it is correct also

i have tried this and it seems easy to me.but also upper code is good :)

VB.NET:
SELECT * 
FROM TableName 
WHERE DateDiff("m",  KTDT,Now )<2

Go to MSDN to read about DATEADD and DATEDIFF.
 
Last edited:
Back
Top