public void Excluir(int id) { string strQuery = string.Format(" DELETE FROM ALUNO WHERE Id = {0} ", id); using (contexto = new Contexto()) { contexto.ExecutaComando(strQuery); } }
private void Alterar(Aluno aluno) { string strQuery = " UPDATE ALUNO SET "; strQuery += string.Format(" Nome = '{0}', ", aluno.Nome); strQuery += string.Format(" Sobrenome = '{0}', ", aluno.Sobrenome); strQuery += string.Format(" DataInscricao = '{0}' ", aluno.DataInscricao); strQuery += string.Format(" WHERE Id = {0} ", aluno.Id); using (contexto = new Contexto()) { contexto.ExecutaComando(strQuery); } }
private void Inserir(Aluno aluno) { string strQuery = " INSERT INTO ALUNO (Nome, Sobrenome, DataInscricao) "; strQuery += string.Format(" VALUES ('{0}', '{1}', '{2}') ", aluno.Nome, aluno.Sobrenome, aluno.DataInscricao); using (contexto = new Contexto()) { contexto.ExecutaComando(strQuery); } }