The mysql-JSP page cannot be published.

Source: Internet
Author: User
Tags mysql insert
Prompt message: java. SQL. SQLException: Columncountdoesn & #39; tmatchvaluecountatrow1atcom. mysql. jdbc. SQLError. createSQLException (SQLError. java: 1055) atcom. mysql. jdbc. SQLError. createSQLException (SQLError. java: 956) atcom. mysql. jdbc. mysqlIO. checkErrorPa mysql insert information jsp

Prompt message:
Java. SQL. SQLException: Column count doesn't match value count at row 1
At com. mysql. jdbc. SQLError. createSQLException (SQLError. java: 1055)
At com. mysql. jdbc. SQLError. createSQLException (SQLError. java: 956)
At com. mysql. jdbc. MysqlIO. checkErrorPacket (MysqlIO. java: 3515)
At com. mysql. jdbc. MysqlIO. checkErrorPacket (MysqlIO. java: 3447)
At com. mysql. jdbc. MysqlIO. sendCommand (MysqlIO. java: 1951)
At com. mysql. jdbc. MysqlIO. sqlQueryDirect (MysqlIO. java: 2101)
At com.mysql.jdbc.ConnectionImpl.exe cSQL (ConnectionImpl. java: 2548)
At com.mysql.jdbc.StatementImpl.exe cuteUpdate (StatementImpl. java: 1605)
At com.mysql.jdbc.StatementImpl.exe cuteUpdate (StatementImpl. java: 1524)
At org.apache.tomcat.dbcp.dbcp.DelegatingStatement.exe cuteUpdate (DelegatingStatement. java: 228)
At org.apache.tomcat.dbcp.dbcp.DelegatingStatement.exe cuteUpdate (DelegatingStatement. java: 228)
At com.wy.JDBConnection.exe cuteUpdata (JDBConnection. java: 39)
At org. apache. jsp. good_005fconfig_jsp. _ jspService (good_005fconfig_jsp.java: 120)
At org. apache. jasper. runtime. HttpJspBase. service (HttpJspBase. java: 70)
At javax. servlet. http. HttpServlet. service (HttpServlet. java: 722)
At org. apache. jasper. servlet. JspServletWrapper. service (JspServletWrapper. java: 432)
At org. apache. jasper. servlet. JspServlet. serviceJspFile (JspServlet. java: 390)
At org. apache. jasper. servlet. JspServlet. service (JspServlet. java: 334)
At javax. servlet. http. HttpServlet. service (HttpServlet. java: 722)
At org. apache. catalina. core. ApplicationFilterChain. internalDoFilter (ApplicationFilterChain. java: 305)
At org. apache. catalina. core. ApplicationFilterChain. doFilter (ApplicationFilterChain. java: 210)
At org. apache. catalina. core. StandardWrapperValve. invoke (StandardWrapperValve. java: 222)
At org. apache. catalina. core. StandardContextValve. invoke (StandardContextValve. java: 123)
At org. apache. catalina. authenticator. AuthenticatorBase. invoke (AuthenticatorBase. java: 472)
At org. apache. catalina. core. StandardHostValve. invoke (StandardHostValve. java: 168)
At org. apache. catalina. valves. ErrorReportValve. invoke (ErrorReportValve. java: 99)
At org. apache. catalina. core. StandardEngineValve. invoke (StandardEngineValve. java: 118)
At org. apache. catalina. connector. CoyoteAdapter. service (CoyoteAdapter. java: 407)
At org. apache. coyote. http11.20.acthttp11processor. process (AbstractHttp11Processor. java: 1002)
At org. apache. coyote. AbstractProtocol $ AbstractConnectionHandler. process (AbstractProtocol. java: 585)
At org.apache.tomcat.util.net. JIoEndpoint $ SocketProcessor. run (JIoEndpoint. java: 310)
At java. util. concurrent. ThreadPoolExecutor. runWorker (ThreadPoolExecutor. java: 1145)
At java. util. concurrent. ThreadPoolExecutor $ Worker. run (ThreadPoolExecutor. java: 615)
At java. lang. Thread. run (Thread. java: 745)

Related code:

<% @ Page contentType = "text/html; charset = GBK" import = "java. SQL. *, java. util. Date" %>




Good_config page


<%!
Date date = new Date ();
String SQL;
ResultSet rs;
%>
<%
Request. setCharacterEncoding ("gb2312 ");

String gname = request. getParameter ("gname ");
String gclass = request. getParameter ("gclass ");
String gcount = request. getParameter ("gcount ");
String gunit = request. getParameter ("gunit ");
String startProvince = request. getParameter ("startProvince ");
String gstartcity = request. getParameter ("gstartcity ");
String endProvince = request. getParameter ("endProvince ");
String gendcity = request. getParameter ("gendcity ");
String gtransstyle = request. getParameter ("gtransstyle ");
String gtime = request. getParameter ("gtime ");
String glink = request. getParameter ("glink ");
String gphone = request. getParameter ("gphone ");
String gremark = request. getParameter ("gremark ");
String grequest = request. getParameter ("grequest ");
String username = (String) session. getAttribute ("name ");

Java. SQL. Date gshowdate = new java. SQL. Date (date. getYear (), date. getMonth (), date. getDate ());

SQL = "insert into tb_GoodsMeg values ('" + gclass + "', '" +
Gname + "','" + gcount + "','" + gunit + "','" + startProvince + "','" +
Gstartcity + "','" + endProvince + "','" + gendcity + "','" +
Gtransstyle + "','" + gtime + "','" + gphone + "','" +
Glink + "','" + gshowdate + "','" + gremark + "','" + grequest + "','" + username + "')";

Boolean sert=connection.exe cuteUpdata (SQL );

If (sert)
{%>

Alert ("The goods information you entered has been completed successfully !!! ");

<%
Response. sendRedirect ("goods_select.jsp ");
} Else
{
%>

Alert ("the goods you entered failed to be published !!! ");

<%
Response. sendRedirect ("goods_add.jsp ");
}
%>



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.