public static Int32 EmailRegister(Int32 empNo, String eMail)
{
try
{
if (ParseEmailAddress(eMail) == 0)
{
return 0;
}
//データベース接続
OracleConnection conn =
new OracleConnection("context connection=true");
conn.Open();
OracleCommand cmd = conn.CreateCommand();
cmd.CommandText = "Update EMP set";
cmd.CommandText += " EMAIL= :EMAIL";
cmd.CommandText += " Where EMPNO = :EMPNO";
//パラメータ定義
OracleParameter prmEMAIL = cmd.CreateParameter();
prmEMAIL.Value = eMail;
cmd.Parameters.Add(prmEMAIL);
OracleParameter prmEMPNO = cmd.CreateParameter();
prmEMPNO.Value = empNo;
cmd.Parameters.Add(prmEMPNO);
//戻り値は行数(0は失敗)
return cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
return 0;
}
} |