GALERA! PARA CONCLUIR O ASSUNTO DO TÓPICO “METODOS” CRIADO EM OUTRO TOPICO
POR OUTRO USUARIO
===========================================================
# String sql = "create table if not exists cliente01 (num int(20) unsigned not null auto_increment, Cod varchar (10),Produto varchar (40),Valor varchar(10),primary key(num))";
# PreparedStatement stmt = conexao.prepareStatement(sql);
# //stmt.setString(1,c02);
# stmt.execute();
# stmt.close();
# }
#
# public void adicionaitens(Titulo t1) throws SQLException {
# String sql = "insert into cliente01 (Cod, Produto,Valor)" + "values (?,?,?)";
# PreparedStatement stmt = conexao.prepareStatement(sql);
#
# stmt.setString(1, t1.getCod());
# stmt.setString(2, t1.getProduto());
# stmt.setString(3, t1.getValor());
#
#
# stmt.execute();
# stmt.close();
#
# }
#
# public List<Titulo> getLista01(String C01) throws SQLException {
#
# //pesquisa
# String sql = ("Select * from cliente01 where Cod like ?");
#
# PreparedStatement stmt = this.conexao.prepareStatement(sql);
# stmt.setString(1, C01);
#
#
# ResultSet rs = stmt.executeQuery();
#
# List<Titulo> minhaLista = new ArrayList<Titulo>();
#
# while (rs.next()) {
# Titulo t1 = new Titulo();
# t1.setNum(rs.getString("num"));
# t1.setCod(rs.getString("Cod"));
# t1.setProduto(rs.getString("Produto"));
# t1.setValor(rs.getString("Valor"));
#
# minhaLista.add(t1);
# }
# rs.close();
# stmt.close();
# return minhaLista;
# }
# public void Fechartabela() throws SQLException {
#
#
# String sql = "drop table cliente01";
#
# PreparedStatement stmt = conexao.prepareCall(sql);
#
# stmt.execute();
# stmt.close();
# }
# public void remove(Titulo t1) throws SQLException {
# String sql = "delete from cliente01 where num=?";
# PreparedStatement stmt = conexao.prepareStatement(sql);
#
# stmt.setString(1, t1.getNum());
#
# stmt.execute();
# stmt.close();
#
# }
============================================
PARA AJUDAR eu acho que sempre deve-se respeitar as normas de modelagem e normalizacao
e criar uma tabela só para os cliente não precisa de tudo isso.
Obrigado
espero ter ajudao