Click here to Skip to main content
15,888,112 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Select token_no from billentry where billdate like % convert(datetime,'" & DateTimePicker2.Value & "',103) % "
Posted
Comments
Naveen Roy 17-Apr-14 6:30am    
what is 103 is any Id?
RahulMGunjal 1-May-14 12:49pm    
Its date time format for British Culture

Here is your solution

1) Create this procedure in SQL SERVER(I guess you are using sql server database)
SQL
CREATE PROCEDURE spGetDateByDate(@vDate AS DATETIME)
AS
BEGIN

Select * from billentry where CONVERT(char(15), CONVERT(varchar, Billdate, 101)) like
CONVERT(char(15), CONVERT(varchar,@vDate, 101))

END


2) Then write Vb.net code to connect SQL server and execute this procedure with DateTimePicker2.Value as parameter

3) Get all rows and display in your form

Hope this helps. if does work then accept and vote the solution
 
Share this answer
 
Have you stored date in British/French standard in your database as you are using 103 as format as written in your above query?

Convert both date from database and date from datepicker in same format.

SQL
Select token_no from billentry where CONVERT(nvarchar(30), billdate, 103)like CONVERT(nvarchar(30), '" & DateTimePicker2.Value & "', 103)


Read following link for more clarity

CAST and CONVERT[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900