Click here to Skip to main content
15,917,862 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am Designing report.Except sqldate everything ok. problem is coming when I am reading date from sql databse and store into to c# datetime picker. I stored that date value using datetime picker of C#.Here is my code.
  SqlCommand dc = new SqlCommand("select bdate from Hbillprint", con);
DateTimePicker dt = Convert.ToDateTime(dc.ExecuteScalar());
            MessageBox.Show(dt.ToString());
            dateTimePicker1.Value = dt;

Cannot implicitly convert type 'System.DateTime' to 'System.Windows.Forms.DateTimePicker'	WindowsFormsApplication1	

So how to read that and store in one variable

What I have tried:

I changed datetime picker to datetime and tried.it is not showing any error but date is not coming.today's date only it is displaying.
Posted
Updated 28-Apr-17 21:50pm
v3

1 solution

 
Share this answer
 
Comments
vijay_bale 29-Apr-17 4:31am    
ok solved.Thanks. I have another problem. Can I ask here or raise one new question?
Richard MacCutchan 29-Apr-17 4:39am    
If it's a different issue then you should open a new question.
vijay_bale 29-Apr-17 8:30am    
ok I opened new question for that

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