Retrieving task guid from dataset RRS feed

  • Question

  • hello forum members,

    i am trying to assign resources to tasks and when i retrieve a task guid from dataset, I have conversion errors that i can't figure out. 

    Here is my code for a task id : 

    string taskId = projDs[0].Tables["Task"].Rows[0]["TASK_UID"].ToString();

    newAssignmentRow.TASK_UID = new Guid(taskid); //error here. doesn't convert 

    the error that i am getting is "cannot convert from System.Guid[] to System.Guid

    Does anyone has any ideas? 


    Tuesday, September 2, 2014 4:33 PM


  • never mind. i think i just had my syntax wrong. 

    here is what worked:

                            Guid newGuid = Guid.Parse(taskid);
                            Console.WriteLine("Converted {0} to a Guid", taskid);
                            newAssignmentRow.TASK_UID = newGuid; 
                        catch (ArgumentNullException)
                            Console.WriteLine("The string to be parsed is null.");
                        catch (FormatException)
                            Console.WriteLine("Bad format: {0}", taskid);


    Tuesday, September 2, 2014 5:22 PM