protected void RolesToBeMade(int RoleID, int DepartmentID)
{
string strConnString = ConfigurationManager.ConnectionStrings["jk_devConnectionString"].ConnectionString;
SqlConnection conn = new SqlConnection(strConnString);
try
{
errMsg.Visible = false;
conn.Open();
SqlCommand DBCmd = new SqlCommand("insDepartmentRole", conn);
DBCmd.CommandType = CommandType.StoredProcedure;
SqlParameter paramRID = new SqlParameter("@_RoleID", SqlDbType.Int, 10);
paramRID.Value = RoleID;
SqlParameter paramDID = new SqlParameter("@_DepartmentID", SqlDbType.Int, 10);
paramDID.Value = DepartmentID;
SqlParameter sqlOut = new SqlParameter("@_result", SqlDbType.Int);
sqlOut.Direction = ParameterDirection.ReturnValue;
DBCmd.Parameters.Add(paramRID);
DBCmd.Parameters.Add(paramDID);
DBCmd.Parameters.Add(sqlOut);
DBCmd.ExecuteNonQuery();
Int32 intI;
intI = (Int32)DBCmd.Parameters["@_result"].Value;
if (intI != 0)
{
throw new ArgumentException("Database Error");
}
}
catch (Exception err)
{
util.logging.Log2file(err.Message.ToString(), Server.MapPath("~") + "\\Logging.log", 10000);
errMsg.Visible = true;
errMsg.Text = "Sorry, an error occurred. Please try your request again at another time.";
}
finally
{
conn.Close();
}
}
Thursday, April 24, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment