Pessoal estou tentando fazer um cadastro em meu banco de dados e ele dispara um erro quando clico no botao de cadastro…
vejam abaixo o erro
run:
java.sql.SQLException: Column count doesn't match value count at row 1
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1056)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3376)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3308)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1837)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1961)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2543)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1737)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2022)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1940)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1925)
at br.com.Papelaria.Cliente.ClienteControl.cadastrarCliente(ClienteControl.java:68)
e vejam meu codigo como esta
try
{
pstm = bd.conectar().prepareStatement(cadastraCliente);
pstm.setString(1, cliente.getNome());
pstm.setString(2, cliente.getEndereco());
pstm.setString(3, cliente.getBairro());
pstm.setString(4, cliente.getCidade());
pstm.setString(5, cliente.getUf());
pstm.setString(6, cliente.getCep());
pstm.setString(7, cliente.getTelefone());
pstm.setString(8, cliente.getCelular());
pstm.setString(9, cliente.getDatanasc());
pstm.setString(10, cliente.getCpf());
pstm.setString(11, cliente.getRg());
pstm.setString(12, cliente.getEstadoC());
pstm.setString(13, cliente.getEmail());
pstm.setString(14, cliente.getEmpressa());
pstm.setString(15, cliente.getProfissao());
pstm.setString(16, cliente.getSalario());
pstm.executeUpdate(); !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! O ERRO OCORRE AQUI!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
bd.desconectar();
}
abaixo a conexao
String cadastraCliente = "INSERT INTO CLIENTE (nome, endereco, bairro, " +
"cidade, uf, cep, telefone, celular, datanasc, cpf, rg , estadoC, email, empresa"+
"profissao, salario) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
estou fazendo alguma coissa errada pessoal? vlw pela forca abracao!