Assuming that msg is a varchar or similar then try the following ...
SqlParameter Outparam = new SqlParameter("msg", SqlDbType.NVarChar);
Outparam.Direction = ParameterDirection.Output;
SqlParameter[] parameters = new SqlParameter[]
{
new SqlParameter("Fname",Fname),
new SqlParameter("Lname",Lname),
new SqlParameter("UserName",UserName),
new SqlParameter("Password",Password),
new SqlParameter("Mobile",Mobile),
new SqlParameter("fk_RoleId",RoleId),
new SqlParameter("Pic",Pic),
new SqlParameter("Date",Date),
new SqlParameter("Active",Active),
Outparam
};
string msg;
int Result = ExecuteNonQuery("sp_Insert_User", parameters, out msg);
Note that I changed your
ExecuteNonQuery
function as follows
public static int ExecuteNonQuery(string commandText, SqlParameter[] parameters, out string msg)
{
SqlConnection con = new SqlConnection();
SqlCommand cmd = new SqlCommand(commandText, con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddRange(parameters);
if (con.State == ConnectionState.Closed)
con.Open();
int rowsAffected = cmd.ExecuteNonQuery();
msg = (string)cmd.Parameters["msg"].Value;
if (con.State == ConnectionState.Open)
con.Close();
return rowsAffected;
}
Warning - I have not been able to test this code properly