hud. hud. - 4 years ago 140
Vb.net Question

Like statement for datetime in SQL ASP.NET MVC

I try to do a filter for SQL search. I have a database with columns id,remarks and date. Date column datatype is datetime. What i want to do is using LIKE statement to filter the search. Its like

where date like '%2016%'
. I want data from the year 2016 only. I try to use contains. but no success

Dim Query = From apt In dbb.apt
Where apt.date.Contains("2016")
Select apt.id, apt.remarks, apt.date

Answer Source

Use below to get year value from your date filed.

Year(data_column)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download