Click here to Skip to main content
15,891,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good day all!!!

I have table in MSSQL 2008 that has a time(7) column (column name 'Task_Time').

I'm taking the rows in the table and displaying them in a DataGridView.

When the data is loaded from the database it is placed in a datatable in my project; in which I have declared the column 'Task_Time' as TimeSpan.

The user clicks on a row and it opens a form that loads the values of the row selected.

My problems comes when I'm trying to load the row data into the form. I'm using a DateTimePicker to display the time. I have DateTimePicker format set to time and showupdown set to true. But I keep getting the following error:

"Cannot format the value to the desired type"...

What am I doing wrong???
Posted
Comments
Nelek 15-Mar-13 9:08am    
Could you use the "improve question" widget and post the relevant code envolving the place where the error comes?

1 solution

I changed the column type in the database and datatable to DateTime. that solved the problem.

Then I just format the DataGridViewColumn to display time only.
 
Share this answer
 

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