当前位置: 代码迷 >> ASP.NET >> 有的时候会执行catch里面的代码,请教为什么呢?可能100次里面有2-3次会执行catch
  详细解决方案

有的时候会执行catch里面的代码,请教为什么呢?可能100次里面有2-3次会执行catch

热度:5581   发布时间:2013-02-25 00:00:00.0
有的时候会执行catch里面的代码,请问为什么呢?可能100次里面有2-3次会执行catch
public   bool   Login(string   pwd,   string   domain,   string   uid,   int   ProvCode,   ref   string   errmsg,ref   int   aliasFlag,ref   string   enterpriseSheetNo,
ref   string   longNumber,   ref   string   userMobile,   ref   string   realun)
{  
try
{
OracleParameter   parvalue   =   new   OracleParameter( "paramReturnValue ",   100);
parvalue.Direction   =   ParameterDirection.Output;
OracleParameter   parMsg   =   new   OracleParameter( "paramreturnMsg ",OracleType.NVarChar,200);
parMsg.Direction   =   ParameterDirection.Output;
OracleParameter   parEpId   =   new   OracleParameter( "paramreturnEpId ",-2);
parEpId.Direction   =   ParameterDirection.Output;
OracleParameter   parEpName   =   new   OracleParameter( "paramreturnEpName ",OracleType.NVarChar,200);
parEpName.Direction   =   ParameterDirection.Output;

OracleParameter   parLongNum   =   new   OracleParameter( "paramreturnEpLongNum ",OracleType.NVarChar,50);
parLongNum.Direction   =   ParameterDirection.Output;
OracleParameter   parIsAliaFlag   =   new   OracleParameter( "paramreturnIsAliaFlag ",100);
parIsAliaFlag.Direction   =   ParameterDirection.Output;
OracleParameter   parMobile   =   new   OracleParameter( "paramreturnMobile ",OracleType.NVarChar,50);
parMobile.Direction   =   ParameterDirection.Output;
OracleParameter   parUserNumber   =   new   OracleParameter( "paramreturnUserNumber ",OracleType.NVarChar,50);
parUserNumber.Direction   =   ParameterDirection.Output;

OracleParameter   parPwd   =   new   OracleParameter( "paramPwd ",OracleType.NVarChar,50);
parPwd.Value   =   pwd;

OracleParameter   paramDomain   =   new   OracleParameter( "paramDomain ",OracleType.NVarChar,50);
paramDomain.Value   =   domain;

OracleParameter   paramUserNumber   =   new   OracleParameter( "paramUserNumber ",OracleType.NVarChar,50);
paramUserNumber.Value   =   uid;

OracleParameter[]   cmdpar   =   new   OracleParameter[]
{
paramDomain,
paramUserNumber,
parPwd,
parMsg,
parEpId,
parEpName,parLongNum,parIsAliaFlag,parMobile,parUserNumber,parvalue
};

base.ExecuteProcedure( "Cmail_Admin_Login.Cmail_Login ",cmdpar);
bool   loginSuc   =   false;
if   (int.Parse(parvalue.Value.ToString())   ==   0)   //   成功
{
aliasFlag   =   int.Parse(parIsAliaFlag.Value.ToString());
enterpriseSheetNo   =   parEpId.Value.ToString();
longNumber   =   parLongNum.Value.ToString();
userMobile   =   parMobile.Value.ToString();
realun   =   parUserNumber.Value.ToString();
errmsg   =   "登陆成功! ";
loginSuc   =   true;
}
else
{
errmsg   =   parMsg.Value.ToString();
return   false;
}
return   loginSuc;
}
catch(Exception   ex)
{
errmsg   =   "数据库连接错误! "   +   ex.Message;
return   false;
}

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