Exemple #1
0
        public void Add(Insert value)
        {
            WithConnection(
                c =>
            {
                Console.WriteLine("before Add");

                var cmd = value.Command(c);

                cmd.Parameters.AddWithValue(
                    value
                    );

                cmd.ExecuteNonQuery();


                Console.WriteLine("after Add");
            }
                );
        }
        public void Add(Insert value)
        {
            WithConnection(
                  c =>
                  {
                      Console.WriteLine("before Add");

                      var cmd = value.Command(c);

                      cmd.Parameters.AddWithValue(
                           value
                      );

                      cmd.ExecuteNonQuery();


                      Console.WriteLine("after Add");
                  }
             );
        }
        private void Inserir(Aluno aAluno)
        {
            var insert = new Insert
            {
                Campos  = Aluno.ArrCampos.ToList(),
                Tabela  = Aluno.CTabela,
                Valores = new List <string>
                {
                    "@Nome",
                    "@Mae",
                    "@DtaNasc"
                }
            };

            insert.Campos.RemoveAt(0);
            var parametros = insert.Command().Parameters;

            parametros.AddWithValue("@Nome", aAluno.Nome);
            parametros.AddWithValue("@Mae", aAluno.Mae);
            parametros.AddWithValue("@DtaNasc", aAluno.DtaNasc);
            insert.Executar();
        }