Welcome to the Axosoft Community, Sign in | Register | Help
in Search

Whats Wrong With This Picture?

Last post 04-07-2008, 4:48 PM by DanGreen. 2 replies.
Sort Posts: Previous Next
  •  04-06-2008, 5:38 PM 15535

    Whats Wrong With This Picture?

    Hello all,

    Having some issues with the TypeService...
     

    if (defectItem.PriorityTypeId > 0)
                {
                    this.lblItemPriority.Text = (string)new TypeService.TypeHandler()
                        .GetPriorityTypes(securityToken)
                        .Tables[0]
                        .Rows[defectItem.PriorityTypeId - 1]["Name"];
                }

     

    Am I going the wrong way? I seem to be getting the wrong ["Name"] from the service 

     

    Daniel

    OnTime2008 


    Daniel Green
    Explorer Technologies
    Support Powered by OnTime 2008
  •  04-07-2008, 7:59 AM 15538 in reply to 15535

    Re: Whats Wrong With This Picture?

    You can't use the PriorityTypeId as an index in the Rows collection.  What you need to do is use Table[0].Rows.Find(PriorityTypeId), assuming the primary key is set on that table (which I believe we do set by default on the PriorityTypes), or use Table[0].Select("PriorityTypeId=" + PriorityTypeId.ToString()).


    Dan Suceava
    http://www.axosoft.com
  •  04-07-2008, 4:48 PM 15555 in reply to 15538

    Re: Whats Wrong With This Picture?

    Thanks Dan,

    The working code is therefore...

     
    if (defectItem.PriorityTypeId > 0)
    {
        this.lblItemPriority.Text = (string) new TypeService.TypeHandler()
            .GetPriorityTypes(securityToken)
            .Tables[0]
            .Rows.Find(defectItem.PriorityTypeId)["Name"];
    }


    Daniel Green
    Explorer Technologies
    Support Powered by OnTime 2008
    Filed under:
View as RSS news feed in XML

© 2002 - 2007, Axosoft, LLC. All Rights Reserved. | Privacy
Bug Tracking | Defect Tracking Videos | Help Desk Software