Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. public void ExecDeleteCatalog(long? passUserID, long? passCatalogID, out byte? status)
  2. {
  3. string connStr = System.Configuration.ConfigurationManager.ConnectionStrings[ParametersDb.ConnectionStringName].ConnectionString;
  4. using (SqlConnection conn = new SqlConnection(connStr))
  5. {
  6. using (SqlCommand command = new SqlCommand("P_DeleteCatalog", conn))
  7. {
  8. SqlParameter ReturnValue = new SqlParameter(ParametersDb.ParamReturnValue, SqlDbType.Int, 4);
  9. ReturnValue.Direction = ParameterDirection.ReturnValue;
  10. command.Parameters.Add(ReturnValue);
  11.  
  12. command.Parameters.Add(new SqlParameter("@PassUserID", passUserID));
  13. command.Parameters.Add(new SqlParameter("@PassCatalogID", passCatalogID));
  14. SqlParameter Status = new SqlParameter("@Status", SqlDbType.TinyInt, 1);
  15. Status.Direction = ParameterDirection.Output;
  16. command.Parameters.Add(Status);
  17.  
  18. command.CommandType = CommandType.StoredProcedure;
  19.  
  20. conn.Open();
  21.  
  22. command.ExecuteNonQuery();
  23.  
  24. int? func_ret = UtilDal.ToIntN(ReturnValue.Value);
  25. if (func_ret != null && func_ret != 0)
  26. {
  27. throw new SpNonZeroReturnException(func_ret.Value, "P_DeleteCatalog", command.Parameters);
  28. }
  29.  
  30. status = UtilDal.ToByteN(Status.Value);
  31. }
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement