-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Sanju
Message 1 in Discussion

HI,   How to catch custom exception using ObjectDataSource Control. I am 
calling Business Layer method through ObjectDataSource control,  when Business 
layer method throws exception which will be wrapped to custom exception and 
thrown.  I want to capture the custom exception in UI Layer.   e.g., UI Layer 
Code: protected void Page_Load(object sender, EventArgs e)
{
  try
  {  
   ObjectDataSource1.SelectMethod = "GetAllRoles"; 
  ObjectDataSource1.TypeName =  
             "Shell.BizTalk.Services.BizDashboard.BusinessLayer.RoleBL";
  GridView1.DataSourceID = "ObjectDataSource1";
  GridView1.DataBind();
 }
catch (BizDashboardException objBizDashboardException) // want to capture Here
{
   string s1 = objBizDashboardException.errorNo;
   BizDashboardException.publish(objBizDashboardException);
}
catch (Exception ex)
{
  string s = ex.InnerException.Message; // Always capture this exception
} 

} 
Business Layer Code:
public static roleData GetAllRoles()
{
  roleData objRoleData = null;
try
{
   int x = objRoleData.Tables[0].Rows.Count;
} 
catch (Exception objException)  // Converting to Custom Exception
{
throw new BizDashboardException("BSC-001", objException, objException.Message, 
"RoleBL-GetAllRoles", Severity.Warning);
}
return objRoleData;
} 
  
Thanks in advance. 
 

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member 
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you 
received this message by mistake, please click the "Remove" link below. On the 
pre-addressed e-mail message that opens, simply click "Send". Your e-mail 
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to