Guest User

Untitled

a guest
Jul 19th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. public SqlDataReader ExecuteDataReader(SqlCommand cmd)
  2. {
  3. try
  4. {
  5. OpenConnection();
  6. cmd.Connection = conn;
  7. cmd.CommandType = CommandType.StoredProcedure;
  8.  
  9. SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
  10.  
  11. return dr;
  12. }
  13. catch (Exception ex)
  14. {
  15. Utils.Debug(string.Format("Err in {0}.{1} : {2}nSQL : {3}", this.GetType(), "ExecuteDataReader", ex.Message, cmd.CommandText));
  16. return null;
  17. }
  18. }
  19.  
  20. Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
  21.  
  22. static void ProcessAssessmentCriteria(string UnitReference)
  23. {
  24. SqlCommand cmd = new SqlCommand("TRACKING.DBTool_GetUniqueAssessmentCriteriaByUnitReference");
  25. cmd.Parameters.Add("@UnitReference", SqlDbType.VarChar, 20).Value = UnitReference;
  26.  
  27. SqlDataReader dr = db.ExecuteDataReader(cmd);
  28.  
  29. if (dr.HasRows)
  30. {
  31. while (dr.Read())
  32. {
  33. ProcessDetailAssessmentCriteria(UnitReference, dr["AssessmentRefNumber"].ToString());
  34. Console.WriteLine("---------------");
  35. }
  36. }
  37.  
  38. dr.Close();
  39. }
Add Comment
Please, Sign In to add comment