Little problem in Vb.net
-
I have a field in SQlServer Database which name is "PublishingDate". In it, Date is stored in that format i.e 3/28/2005 In my vb.net program i use select query to fetch all the records of column "PublishingDate" I use the query below to just select year out of whole Date and display result in a combobox. "select distinct DATEPART(yy,publishingdate) from books" Everything will be fine. In Combobox it show all "years" like 2000,2001,2002,2003 I want that when user clicks on any year in a combobox like '2000', it will display results according to that query Select * from books where publishingdate='" & ComVal.text & "' But this query cannot display the result because in database date is stored in this format "3/8/2005" Hope you got the meaning. I use this query, but it cannot display the result. SELECT * From books where publishingdate IN (select Datepart(yy,publishingdate)from books) How can i do this? Plz help me in this regard. Eshban EsHbAn BaHaDuR
-
I have a field in SQlServer Database which name is "PublishingDate". In it, Date is stored in that format i.e 3/28/2005 In my vb.net program i use select query to fetch all the records of column "PublishingDate" I use the query below to just select year out of whole Date and display result in a combobox. "select distinct DATEPART(yy,publishingdate) from books" Everything will be fine. In Combobox it show all "years" like 2000,2001,2002,2003 I want that when user clicks on any year in a combobox like '2000', it will display results according to that query Select * from books where publishingdate='" & ComVal.text & "' But this query cannot display the result because in database date is stored in this format "3/8/2005" Hope you got the meaning. I use this query, but it cannot display the result. SELECT * From books where publishingdate IN (select Datepart(yy,publishingdate)from books) How can i do this? Plz help me in this regard. Eshban EsHbAn BaHaDuR
I take it this means the date is stored as a string ? SELECT * From books where publishingdate LIKE '%/' + publishingyear Christian Graus - Microsoft MVP - C++
-
I have a field in SQlServer Database which name is "PublishingDate". In it, Date is stored in that format i.e 3/28/2005 In my vb.net program i use select query to fetch all the records of column "PublishingDate" I use the query below to just select year out of whole Date and display result in a combobox. "select distinct DATEPART(yy,publishingdate) from books" Everything will be fine. In Combobox it show all "years" like 2000,2001,2002,2003 I want that when user clicks on any year in a combobox like '2000', it will display results according to that query Select * from books where publishingdate='" & ComVal.text & "' But this query cannot display the result because in database date is stored in this format "3/8/2005" Hope you got the meaning. I use this query, but it cannot display the result. SELECT * From books where publishingdate IN (select Datepart(yy,publishingdate)from books) How can i do this? Plz help me in this regard. Eshban EsHbAn BaHaDuR