Hello
Kindly provide me a sample code to populate the tasks grid in the ultraganttview from the database. This has to work on selecting a project from a dropdownlist.
Also need to add and modify the tasks and then save back to the table in the database.
Regards
jeni
Hello Jeni,
Could you please send us your sample with database. I`ll be glad to research this issue for you.
Let me know if you have any questions.
Hello Georgi
1. I tried using Nvarchar(50) datatype for the TaskDuration. Still I get the same error on update when duration bigger than 24 hours, say 2 days or 3 days
2. Secondly `Resource Names` are not being saved to the AllProperties field, How do I save the Resource Names in the database?
Thanks in advance
The mentioned issue is expected and it is an error message from your database. Please note that you have TimeSpan dataType in your Duration column, meanwhile your database has Time(7) dataType, so it is not possible direct cast between these two data Types.
You could try:
- if you are using Duration bigger than 24 hours, you could use additional column into your database
- You could use Nvarchar(50) datatype instead of Time(7) in you database
Please let me know if you have any questions.
In Ultraganttview samples, both in tableadapter and sqlcommand I encounter an error `Overflow exception was unhandled`
SqlDbType.Time overflow. Value '4.00:00:00' is out of range. Must be between 00:00:00.0000000 and 23:59:59.9999999.
In the database TaskDuration is of type time(7)
This occurs on editing the Taskduration and also on inserting new task and subtasks.
Also
In the sample with sqlcommand
I encounter an error Failed to convert parameter value from a TimeSpan to a DateTimeOffset.
sqlConnection.Open(); SqlCommand cmd = sqlConnection.CreateCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "sp_GanttTasks_InsertTask"; cmd.Parameters.Add("@TaskID", SqlDbType.UniqueIdentifier).Value = e.Task.Id; cmd.Parameters.Add("@ProjectKey", SqlDbType.VarChar, 50).Value = "p1"; cmd.Parameters.Add("@TaskName", SqlDbType.VarChar, 50).Value = e.Task.Name; cmd.Parameters.Add("@TaskStartTime", SqlDbType.DateTime).Value = e.Task.StartDateTime; cmd.Parameters.Add("@TaskDuration", SqlDbType.DateTimeOffset).Value = e.Task.Duration; cmd.Parameters.Add("@ParentTaskID", SqlDbType.UniqueIdentifier).Value = e.Task.Parent; cmd.Parameters.Add("@TaskPercentComplete", SqlDbType.Int).Value = e.Task.PercentComplete; cmd.Parameters.Add("@AllProperties", SqlDbType.Binary).Value = null;
cmd.ExecuteNonQuery();
Kindly provide a solution for this.
Jeni
Thanks for your post.