Question sorting data base on date

tonifirnandes

Member
Joined
Mar 7, 2013
Messages
20
Programming Experience
1-3
Hello dear all best programmer,


good morning (because of in batam indonesia it's 9 O'Clock AM)


hopely you would like to help me again and solve my problem.
i've problem i want to show data base on selected date.
i've a table that consist of :
no nama date
1 a 15/04/2012
2 b 15/04/2012
3 c 16/04/2012
4 d 16/04/2012
5 e 17/04/2012


so when user input a selected date in a textbox like : 15/04/2012 and then the data will show like :


no nama date
1 a 15/04/2012
2 b 15/04/2012


but i can't do that. i 've made a program : select no, nama, date from table where date = textbox1.text , after the application start but there is no data show up.
hopely you would understand of that and would like to help me solve the problem.




thanks and best regards,


toni firnandes.
 
Don't use a TextBox. Use a DateTimePicker, which is specifically designed for picking dates and/or times. If you're determined to use a TextBox then you should use Date.TryParse or .TryParseExact to validate and convert the input to a Date. To learn how to query a database and filter based on user input, follow the Blog link in my signature and check out my post on Parameters In ADO.NET. The example even uses a DateTimePicker.
 
Don't use a TextBox. Use a DateTimePicker, which is specifically designed for picking dates and/or times. If you're determined to use a TextBox then you should use Date.TryParse or .TryParseExact to validate and convert the input to a Date. To learn how to query a database and filter based on user input, follow the Blog link in my signature and check out my post on Parameters In ADO.NET. The example even uses a DateTimePicker.

i've tried to user datetimepicker but i get this error :
Conversion failed when converting date and/or time from character string.
i use the code : SELECT dbo.T_V2_OvertimeData.WorkDate, dbo.T_V2_OvertimeData.EmpId, dbo.T_V2_Employees.EmpName, dbo.T_V2_Employees.Discipline, dbo.T_V2_OvertimeData.PlanManhours, dbo.T_V2_OvertimeData.Approved FROM dbo.T_V2_OvertimeData, dbo.T_V2_Employees Where dbo.T_V2_OvertimeData.WorkDate = '" & DateTimePicker1.Value.ToShortDateString & "' order by WorkDate

error i use : DateTimePicker1.Value.ToShortDateString or DateTimePicker1.Value

hopely you would like to give me the code thanks.
 
and i've tried to input the value manually like input '19/02/2012' i get the same eror when i use datetimepicker.
the code : SELECT dbo.T_V2_OvertimeData.WorkDate, dbo.T_V2_OvertimeData.EmpId, dbo.T_V2_Employees.EmpName, dbo.T_V2_Employees.Discipline, dbo.T_V2_OvertimeData.PlanManhours, dbo.T_V2_OvertimeData.Approved FROM dbo.T_V2_OvertimeData, dbo.T_V2_Employees Where dbo.T_V2_OvertimeData.WorkDate = '19/02/2012' order by WorkDate

how terrible it is. please help.
thanks.
 
I told you to read my blog post on ADO.NET parameters for a reason. If you had done that then it would already be working and you wouldn't have to have asked any more questions. If you're just going to ignore instructions when provided then I'm not going to waste my time providing them.
 
I told you to read my blog post on ADO.NET parameters for a reason. If you had done that then it would already be working and you wouldn't have to have asked any more questions. If you're just going to ignore instructions when provided then I'm not going to waste my time providing them.

well thanks you very much for your helping Mr.
and your blog is a great and has many knowledges in that.
actually i've read all the content especially in ado.net categories, but i am so sorry because of i still can understand and solve my problem.
if its okay, could you tell me the solution directly, i don't mean i don't wan to try again to solve that myself and with your instruction but i don't have the ability like that i still newbie. hopely you understand , thaks you very much.


best regads,
toni firnandes.
 
Back
Top