Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="table"></param>
        /// <param name="parameters"></param>
        public virtual void SetParameters(SqlTable table, StatementParameterCollection parameters)
        {
            if (HasQuery)
            {
                query.SetParameters(table, parameters);
            }
            else
            {
                IColumn sqlColumn = table.ColumnList.FirstOrDefault(item => item.Name.Equals(column, StringComparison.OrdinalIgnoreCase));
                DbType? dataType  = sqlColumn != null ? sqlColumn.ColumnType : null;

                StatementParameter parameter1 = new StatementParameter {
                    Name = index.ToString()
                };
                SqlUtils.PrepareParameter(parameter1, val, dataType);
                parameters.Add(parameter1);

                if (op.ToUpper().IndexOf(Between, StringComparison.Ordinal) > -1)
                {
                    StatementParameter parameter2 = new StatementParameter {
                        Name = index2.ToString()
                    };
                    SqlUtils.PrepareParameter(parameter2, val2, dataType);
                    parameters.Add(parameter2);
                }
            }
        }
Esempio n. 2
0
 public virtual void SetInParameters(SqlTable table, StatementParameterCollection parameters)
 {
     if (HasQuery)
     {
         query.SetParameters(table, parameters);
     }
     else
     {
         var values = (IList)Value;
         if (values != null && values.Count > 0)
         {
             IColumn sqlColumn = table.ColumnList.FirstOrDefault(item => item.Name.Equals(column, StringComparison.OrdinalIgnoreCase));
             DbType? dataType  = sqlColumn != null ? sqlColumn.ColumnType : null;
             for (Int32 i = 0; i < values.Count; i++)
             {
                 StatementParameter parameter = new StatementParameter {
                     Name = index.ToString()
                 };
                 SqlUtils.PrepareParameter(parameter, values[i], dataType);
                 parameters.Add(parameter);
                 index++;
             }
         }
     }
 }
Esempio n. 3
0
        private StatementParameterCollection ChangeStateParm(DbCommand dbCmd)
        {
            DbParameterCollection        parmsList = dbCmd.Parameters;
            StatementParameterCollection sparmList = new StatementParameterCollection();

            foreach (DbParameter dbParm in parmsList)
            {
                StatementParameter stateParm = new StatementParameter();
                stateParm.Name      = dbParm.ParameterName;
                stateParm.DbType    = dbParm.DbType;
                stateParm.Direction = dbParm.Direction;

                stateParm.Size  = dbParm.Size;
                stateParm.Value = dbParm.Value;
                sparmList.Add(stateParm);
                // ParmsList.Add(stateParm);
            }
            return(sparmList);
        }
Esempio n. 4
0
        private StatementParameterCollection ChangeStateParm(DbCommand dbCmd)
        {
            DbParameterCollection parmsList = dbCmd.Parameters;
            StatementParameterCollection sparmList = new StatementParameterCollection();
            foreach (DbParameter dbParm in parmsList)
            {
                StatementParameter stateParm = new StatementParameter();
                stateParm.Name = dbParm.ParameterName;
                stateParm.DbType = dbParm.DbType;
                stateParm.Direction = dbParm.Direction;

                stateParm.Size = dbParm.Size;
                stateParm.Value = dbParm.Value;
                sparmList.Add(stateParm);
                // ParmsList.Add(stateParm);
            }
            return sparmList;
        }