Posted By


mn232nm on 11/02/08

Tagged


Statistics


Viewed 531 times
Favorited by 0 user(s)

AccessHelperUtility


/ Published in: C#
Save to your folder(s)

AccessHelperUtility.cs


Copy this code and paste it in your HTML
  1. using System;
  2. using System.Data.OleDb;
  3. using System.Collections.Generic;
  4. using System.Text;
  5.  
  6. namespace Web.DataAccess
  7. {
  8. public sealed class AccessHelperUtility
  9. {
  10. private AccessHelperUtility() { }
  11.  
  12. public static Dictionary<string, OleDbParameter> OleDbParameterArrayToGDictionary(params OleDbParameter[] paras)
  13. {
  14. if (null == paras) throw new ArgumentNullException("paras");
  15. Dictionary<string, OleDbParameter> retval = new Dictionary<string, OleDbParameter>();
  16. foreach (OleDbParameter p in paras) retval.Add(p.ParameterName, p);
  17.  
  18. return retval;
  19. }
  20.  
  21. public static List<OleDbParameter> OleDbParameterGDictionaryToGList(Dictionary<string, OleDbParameter> paras)
  22. {
  23. if (null == paras) throw new ArgumentNullException("paras");
  24.  
  25. List<OleDbParameter> retval = new List<OleDbParameter>();
  26. foreach (string k in paras.Keys) retval.Add(paras[k]);
  27. return retval;
  28. }
  29.  
  30. public static OleDbParameter[] OleDbParameterGDictionaryToArray(Dictionary<string, OleDbParameter> paras)
  31. {
  32. if (null == paras) throw new ArgumentNullException("paras");
  33.  
  34. List<OleDbParameter> retval = new List<OleDbParameter>();
  35. foreach (string k in paras.Keys)
  36. retval.Add(paras[k]);
  37. return retval.ToArray();
  38. }
  39. }
  40. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.