Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
155
Ultraganttview save tasks
posted

Hello,

I have a problem when I save my tasks from my current project to the database. When I save it to my database, I can't open my tasks properties anymore and the also the Predecessors field is cleared (as you can see in the screenshot). Screenshot 1 is before saving, screenshot 2 is after doing:

foreach (Project prj in this.ultraCalendarInfo1.Projects)
{
    for (int i = 0; i < prj.Tasks.Count; i++)
    {
        DataRow[] taskRow = this.ds.Tables["Tasks"].Select("TaskID = '" + prj.Tasks[i].Id + "'");
        if (taskRow.Length == 1)
        {
            taskRow[0]["RowIndex"] = i;
        }
    }
}
tda.Update(ds,"Tasks");

With tda being:

tda = new SqlDataAdapter();
SqlCommand cmdT = conn.CreateCommand();
cmdT.CommandText = "SELECT * FROM Task order by ProjectKey, RowIndex";
tda.SelectCommand = cmdT;
sqlCmdBuilderT = new SqlCommandBuilder(tda);

I know it has something to do with the foreach loop. But I need that before the save so I can keep the current order in the tasks. Because when I save without the foreach the defaultsort on date will be used and the order will be gone.

Kind regards,

Robbe

Parents
No Data
Reply Children
No Data