Example #1
0
        protected string AddParameter(DataField df)
        {
            We7DataColumn dc  = df.Column;
            string        _f0 = String.Format("{0}P{1}", Prefix, parametersCount++);
            DataParameter _f1 = new DataParameter();

            _f1.DbType        = ModelDBHelper.ConvertTypeCodeToDbType(dc.DataType);
            _f1.ParameterName = _f0;
            _f1.Value         = df.Value;
            _f1.SourceColumn  = dc.Name;
            _f1.Size          = dc.MaxLength;
            _f1.IsNullable    = dc.Nullable;
            if (_f1.Value == null)
            {
                if (_f1.DbType == DbType.String)
                {
                    _f1.Value = "";
                }
                else if (_f1.DbType == DbType.DateTime)
                {
                    _f1.Value = DateTime.Now;
                }
            }
            SQL.Parameters.Add(_f1);
            return(_f0);
        }
Example #2
0
        protected string AddParameter(We7DataColumn dc, object v)
        {
            string        _f0 = String.Format("{0}P{1}", Prefix, parametersCount++);
            DataParameter _f1 = new DataParameter();

            _f1.DbType        = ModelDBHelper.ConvertTypeCodeToDbType(dc.DataType);
            _f1.ParameterName = _f0;
            _f1.Value         = v;
            _f1.SourceColumn  = dc.Name;
            _f1.Size          = dc.MaxLength;
            _f1.IsNullable    = dc.Nullable;
            SQL.Parameters.Add(_f1);
            return(_f0);
        }