Пример #1
0
        public void Add(OdbcType type, Object objValue)
        {
            OdbcParameter parm = new OdbcParameter(type.ToString(), type);

            parm.Value = objValue;
            this.Add(parm);
        }
        private static CodeExpression BuildNewOdbcParameterStatement(DesignParameter parameter)
        {
            OdbcParameter parameter2 = new OdbcParameter();
            OdbcType      odbcType   = OdbcType.Char;
            bool          flag       = false;

            if ((parameter.ProviderType != null) && (parameter.ProviderType.Length > 0))
            {
                try
                {
                    odbcType = (OdbcType)Enum.Parse(typeof(OdbcType), parameter.ProviderType);
                    flag     = true;
                }
                catch
                {
                }
            }
            if (!flag)
            {
                parameter2.DbType = parameter.DbType;
                odbcType          = parameter2.OdbcType;
            }
            return(NewParameter(parameter, typeof(OdbcParameter), typeof(OdbcType), odbcType.ToString()));
        }
 public TypeMap this [OdbcType odbcType]
 {
         get {
                 foreach (TypeMap map in List){
                         if (map.OdbcType == odbcType
                             && (map.BitMask & TypeMap.DefaultForOdbcType) > 0 )
                                 return map;
                 }
                 throw new ArgumentException (String.Format ("Type mapping for odbc type {0} is not found", 
                                                             odbcType.ToString ()
                                                             )
                                              );
         }
         set {
                 int i = IndexOf (odbcType);
                 if (i == -1)
                         Add (value);
                 List [i] = value;
         }
 }