Ejemplo n.º 1
0
        /// <summary>
        /// 执行Command
        /// </summary>
        /// <param name="cc"></param>
        /// <returns></returns>
        public int Execute(IConnectionContext cc)
        {
            Command cmd = Command.GetThreadCommand().AddSqlText("Insert into ").AddSqlText(_mTable);
            StringBuilder names = new StringBuilder(),
                          values = new StringBuilder();
            for (int i = 0; i < _mInserFields.Count; i++)
            {
                if (i > 0)
                {
                    names.Append(",");
                    values.Append(",");
                }
                Field field = _mInserFields[i];
                names.Append(field.Name);
                if (field.IsParameter)
                {
                    values.Append("@").Append(field.ParameterName);
                    cmd.AddParameter(field.ParameterName, field.Value ?? DBNull.Value);
                }
                else
                    values.Append(field.Value);

            }
            cmd.SqlText.Append("(").Append(names).Append(")").Append(" Values(").Append(values).Append(")");
            return cc.ExecuteNonQuery(cmd);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 执行Command
        /// </summary>
        /// <param name="cc"></param>
        /// <returns></returns>
        public int Execute(IConnectionContext cc)
        {
            Command cmd = Command.GetThreadCommand().AddSqlText("Delete from ").AddSqlText(_mTable);

            return 0;
            return cc.ExecuteNonQuery(cmd);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 执行Command
        /// </summary>
        /// <param name="cc"></param>
        /// <returns></returns>
        public int Execute(IConnectionContext cc)
        {
            Command       cmd    = Command.GetThreadCommand().AddSqlText("Insert into ").AddSqlText(_mTable);
            StringBuilder names  = new StringBuilder(),
                          values = new StringBuilder();

            for (int i = 0; i < _mInserFields.Count; i++)
            {
                if (i > 0)
                {
                    names.Append(",");
                    values.Append(",");
                }
                Field field = _mInserFields[i];
                names.Append(field.Name);
                if (field.IsParameter)
                {
                    values.Append("@").Append(field.ParameterName);
                    cmd.AddParameter(field.ParameterName, field.Value ?? DBNull.Value);
                }
                else
                {
                    values.Append(field.Value);
                }
            }
            cmd.SqlText.Append("(").Append(names).Append(")").Append(" Values(").Append(values).Append(")");
            return(cc.ExecuteNonQuery(cmd));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 执行Command
        /// </summary>
        /// <param name="cc"></param>
        /// <returns></returns>
        public int Execute(IConnectionContext cc)
        {
            Command cmd = Command.GetThreadCommand().AddSqlText("Delete from ").AddSqlText(_mTable);

            return(0);

            return(cc.ExecuteNonQuery(cmd));
        }
Ejemplo n.º 5
0
 public int Execute(IConnectionContext cc)
 {
     return(cc.ExecuteNonQuery(_cmd));
 }