C# - 此代码无法正常运行的任何原因?

时间:2008-10-08 15:14:51

标签: c#

出于某种原因,第1节有效但第2节没有。当以相反的顺序运行时(2之前的2),第1节(附属)根本不运行。所有数据都是一样的。

//Section 1

            UserService.DsUserAttributes dsAffiliation = us_service.GetUserAttributeDropDown(systemId, "Affiliation");
            Affiliation.DataSource = dsAffiliation.tblDropDownValues;
            Affiliation.DataTextField = "AttrValue";
            Affiliation.DataValueField = "Id";
            Affiliation.DataBind();                

//Section 2                 
            UserService.DsUserAttributes dsCountry = us_service.GetUserAttributeDropDown(systemId, "Country");
            Country.DataSource = dsCountry.tblDropDownValues;
            Country.DataTextField = "AttrValue";
            Country.DataValueField = "Id";
            Country.DataBind();

2 个答案:

答案 0 :(得分:2)

似乎us_service.GetUserAttributeDropDown(systemId, "Country")dsCountry.tblDropDownValues正在抛出异常。您需要使用调试器来查看哪个以及为什么。

答案 1 :(得分:0)

我猜这很大程度上取决于“国家”和“关联”对象......可能会发生任何事情。没有任何例外或类似的东西,很难远程调试这些东西^^

相关问题