Porque me sale este error ?:
! MYSQL Exception: Column count doesn't match value count at row 1
cuando compilo la siguiente clase :
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class PedidosDB extends HttpServlet
{
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
res.setContentType("text/html");
PrintWriter out = res.getWriter();
String telbestell_id = req.getParameter("tpedido_id");
String telkunde_id=req.getParameter("tusuario_id");
String teldatum= req.getParameter ("tdate");
String telpreis= req.getParameter ("tprecio");
//DB-Treiber
try
{
Class.forName("org.gjt.mm.mysql.Driver");
}
catch( ClassNotFoundException e)
{
out.println("DB-Treiber nicht da!");
}
//Connection
try
{
Connection con= DriverManager.getConnection("jdbc:mysql://localhost:3306/dy36","dy36","bmAx");
Statement st = con.createStatement();
try
{
st.executeUpdate("drop table if exists PEDIDO;");
}
catch(Exception e)
{
out.println("Problem mit: DROP TABLE PEDIDO!");
}
st.executeUpdate("create table PEDIDO(pedido_id int(10) NOT NULL AUTO_INCREMENT, usuario_id int(10), date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,preicio int(11) NOT NULL,PRIMARY KEY (pedido_id))");
st.executeUpdate("insert into Person values ('"+telprecio+"')");
out.println("<html><head><title>PEDIDO</title></head>");
out.println("<body>******PEDIDO*******<hr><br>");
out.println("<TABLE Border=10 CellPadding=5><TR>");
out.println("<th>PEdidoID</th><th>usuario_id</th><th>Date</th><th>Precio</th></TR>");
ResultSet rs = st.executeQuery("select * from PEDIDO");
while(rs.next())
{
String spedido_id= rs.getString("pedido_id");
String susuario_id = rs.getString("usuario_id");
String sdate=rs.getString("");
String spreis=rs.getString("Preis");
out.println("<TR>");
out.println("<TD>"+sbestell_id+"</TD>");
out.println("<TD>"+ skunde_id+ "</TD>" );
out.println("<TD>"+ sdatum +"</TD>" );
out.println("<TD>"+ spreis +"</TD>" );
out.println("</TR>");
}
out.println("</TR>"); // fin while
out.println("</TABLE></CENTER></DIV></HTML>");
st.close();
con.close();
}
catch(Exception e)
{
out.println ("! MYSQL Exception: "+e.getMessage());
}
}
public void doPut(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
doGet(req,res);
}
}