<html>
<body>
<%session.setAttribute("username",session.getAttribute("username"));%>
<form method="post" action="booksend.jsp">
<table width="638" height="314" border="0" align="center" cellpadding="0" cellspacing="0">
<!--DWLayoutTable--> <tr>
<td width="612" height="159" valign="top" background="images/show.gif" class="word"><p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<blockquote>
<p align="left"> 1�� ������ı����ͼ��������һ�ࣿ</p>
<p align="left">
<input name="type" type="checkbox" value="kaifa" >
�����ֲ�
<input name="type" type="checkbox" value="baili">
����
<input name="type" type="checkbox" value="jiqiao">
����
<input name="type" type="checkbox" value="shili">
ʵ���
<input name="type" type="checkbox" value="jiaocheng">
�̳�</p>
<p align="left">2�� ��ʹ���������ֱ�����Ի򹤾�?</p>
<p align="left">
<input name="type2" type="checkbox" value="VB" >
VB
<input name="type2" type="checkbox" value="VC">
VC++
<input name="type2" type="checkbox" value="JAVA">
JAVA
<input name="type2" type="checkbox" value="DELPHI">
DELPHI
<input name="type2" type="checkbox" value="ASP">
ASP
<input name="type2" type="checkbox" value="ASPNET">
ASP.NET
<input name="type2" type="checkbox" value="JSP">
JSP
<input name="type2" type="checkbox" value="OTHER">
����</p>
<p>3�� ����Ը�⹺����������ͼ��?</p>
<p>
<input name="type3" type="checkbox" value="rumen" >
������ͼ��
<input name="type3" type="checkbox" value="jiangjie">
����+ʵ��
<input name="type3" type="checkbox" value="wanquan">
��ȫʵ��
<input name="type3" type="checkbox" value="baili">
������
<input name="type3" type="checkbox" value="jiqiao">
������</p>
</blockquote>
<p align="center">
<input type="submit" name="aa" value="�ύ">
</p>
<p align="left"> </p></td>
</tr>
</table>
</body>
</html>-------------------------------
<%@ page contentType="text/html;charset=gb2312" language="java" import="java.sql.*,java.io.*"%>
<%@ include file="include.inc"%>
<%session.setAttribute("username",session.getAttribute("username"));%>
<html>
<style type="text/css">
<!--
.style1 {font-size: 18px}
-->
</style>
<body>
<% Class.forName(CLASSFORNAME);
Connection con=DriverManager.getConnection(SERVER,USER,PWD);
Statement stmt=con.createStatement();
String type[]=request.getParameterValues("type");
String type2[]=request.getParameterValues("type2");
String type3[]=request.getParameterValues("type3");
%>
<%
if(type!=null)
{
for(int i=0;i<type.length;i++)
{
String aa=type[i];
try
{
stmt.executeUpdate("update tb_book set "+aa+"= "+aa+" + 1 where id=1"); }
catch(Exception e)
{
e.printStackTrace();
} }
} if(type2!=null)
{
for(int i=0;i<type2.length;i++)
{
String aa=type2[i]; try
{
stmt.executeUpdate("update tb_language set "+aa+"= "+aa+" + 1 where id=1");
}
catch(Exception e)
{
e.printStackTrace();
}
}
} if(type3!=null)
{
for(int i=0;i<type3.length;i++)
{
String aa=type3[i]; try
{
stmt.executeUpdate("update tb_borrowbook set "+aa+"= "+aa+" + 1 where id=1");
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
%>
<%
ResultSet rs1=stmt.executeQuery("select * from tb_book where id=1");
if(rs1.next())
{
%>
<center><h2>明日科技 图书市场调研卡</h2><table width="567" height="176">
<tr><td><h3>调查结果:</h3></tr></td>
<tr><td><h4>1、您经常购买的编程类图书属于哪一类?</h4></td></tr>
<tr><td>
开发手册类得票:<%=rs1.getString("kaifa")%>票<br>
百例类得票:<%=rs1.getString("baili")%>票<br>
技巧类:<%=rs1.getString("jiqiao")%>票<br>
实例集锦类:<%=rs1.getString("shili")%>票<br>
教程类:<%=rs1.getString("jiaocheng")%>票
</td></tr>
<%
}
ResultSet rs2=stmt.executeQuery("select * from tb_language where id=1");
if(rs2.next())
{
%>
<tr><td><h4>2、您使用下面哪种编程语言或工具?</h4></td></tr>
<tr><td>
VB得票:<%=rs2.getString("VB")%>票<br>
VC++得票:<%=rs2.getString("VC")%>票<br>
JAVA得票:<%=rs2.getString("JAVA")%>票<br>
DELPHI得票:<%=rs2.getString("DELPHI")%>票<br>
ASP得票:<%=rs2.getString("ASP")%>票<br>
ASP.NET得票:<%=rs2.getString("ASPNET")%>票<br>
JSP得票:<%=rs2.getString("JSP")%>票<br>
其他得票:<%=rs2.getString("OTHER")%>票
</td></tr><%
}
ResultSet rs3=stmt.executeQuery("select * from tb_borrowbook where id=1");
if(rs3.next())
{
%>
<tr><td><h4>3、您最愿意购买或借阅哪类图书?</h4></td></tr>
<tr><td>
入门类图书得票:<%=rs3.getString("rumen")%>票<br>
讲解+实例类得票:<%=rs3.getString("jiangjie")%>票<br>
完全实例类得票:<%=rs3.getString("wanquan")%>票<br>
百例型类得票:<%=rs3.getString("baili")%>票<br>
技巧类得票:<%=rs3.getString("jiqiao")%>票<br>
</td></tr>
<%}
%>
</table>
<p align="center" class="style1"><a href="tuichu.jsp">退出</a></p>
</body>
</html>
------------------------------------------------------------------为什么 写不进去!!!!!!!!!!!页面根本没反映 数据库保证能连上 但写不进去数据!
<body>
<%session.setAttribute("username",session.getAttribute("username"));%>
<form method="post" action="booksend.jsp">
<table width="638" height="314" border="0" align="center" cellpadding="0" cellspacing="0">
<!--DWLayoutTable--> <tr>
<td width="612" height="159" valign="top" background="images/show.gif" class="word"><p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<blockquote>
<p align="left"> 1�� ������ı����ͼ��������һ�ࣿ</p>
<p align="left">
<input name="type" type="checkbox" value="kaifa" >
�����ֲ�
<input name="type" type="checkbox" value="baili">
����
<input name="type" type="checkbox" value="jiqiao">
����
<input name="type" type="checkbox" value="shili">
ʵ���
<input name="type" type="checkbox" value="jiaocheng">
�̳�</p>
<p align="left">2�� ��ʹ���������ֱ�����Ի򹤾�?</p>
<p align="left">
<input name="type2" type="checkbox" value="VB" >
VB
<input name="type2" type="checkbox" value="VC">
VC++
<input name="type2" type="checkbox" value="JAVA">
JAVA
<input name="type2" type="checkbox" value="DELPHI">
DELPHI
<input name="type2" type="checkbox" value="ASP">
ASP
<input name="type2" type="checkbox" value="ASPNET">
ASP.NET
<input name="type2" type="checkbox" value="JSP">
JSP
<input name="type2" type="checkbox" value="OTHER">
����</p>
<p>3�� ����Ը�⹺����������ͼ��?</p>
<p>
<input name="type3" type="checkbox" value="rumen" >
������ͼ��
<input name="type3" type="checkbox" value="jiangjie">
����+ʵ��
<input name="type3" type="checkbox" value="wanquan">
��ȫʵ��
<input name="type3" type="checkbox" value="baili">
������
<input name="type3" type="checkbox" value="jiqiao">
������</p>
</blockquote>
<p align="center">
<input type="submit" name="aa" value="�ύ">
</p>
<p align="left"> </p></td>
</tr>
</table>
</body>
</html>-------------------------------
<%@ page contentType="text/html;charset=gb2312" language="java" import="java.sql.*,java.io.*"%>
<%@ include file="include.inc"%>
<%session.setAttribute("username",session.getAttribute("username"));%>
<html>
<style type="text/css">
<!--
.style1 {font-size: 18px}
-->
</style>
<body>
<% Class.forName(CLASSFORNAME);
Connection con=DriverManager.getConnection(SERVER,USER,PWD);
Statement stmt=con.createStatement();
String type[]=request.getParameterValues("type");
String type2[]=request.getParameterValues("type2");
String type3[]=request.getParameterValues("type3");
%>
<%
if(type!=null)
{
for(int i=0;i<type.length;i++)
{
String aa=type[i];
try
{
stmt.executeUpdate("update tb_book set "+aa+"= "+aa+" + 1 where id=1"); }
catch(Exception e)
{
e.printStackTrace();
} }
} if(type2!=null)
{
for(int i=0;i<type2.length;i++)
{
String aa=type2[i]; try
{
stmt.executeUpdate("update tb_language set "+aa+"= "+aa+" + 1 where id=1");
}
catch(Exception e)
{
e.printStackTrace();
}
}
} if(type3!=null)
{
for(int i=0;i<type3.length;i++)
{
String aa=type3[i]; try
{
stmt.executeUpdate("update tb_borrowbook set "+aa+"= "+aa+" + 1 where id=1");
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
%>
<%
ResultSet rs1=stmt.executeQuery("select * from tb_book where id=1");
if(rs1.next())
{
%>
<center><h2>明日科技 图书市场调研卡</h2><table width="567" height="176">
<tr><td><h3>调查结果:</h3></tr></td>
<tr><td><h4>1、您经常购买的编程类图书属于哪一类?</h4></td></tr>
<tr><td>
开发手册类得票:<%=rs1.getString("kaifa")%>票<br>
百例类得票:<%=rs1.getString("baili")%>票<br>
技巧类:<%=rs1.getString("jiqiao")%>票<br>
实例集锦类:<%=rs1.getString("shili")%>票<br>
教程类:<%=rs1.getString("jiaocheng")%>票
</td></tr>
<%
}
ResultSet rs2=stmt.executeQuery("select * from tb_language where id=1");
if(rs2.next())
{
%>
<tr><td><h4>2、您使用下面哪种编程语言或工具?</h4></td></tr>
<tr><td>
VB得票:<%=rs2.getString("VB")%>票<br>
VC++得票:<%=rs2.getString("VC")%>票<br>
JAVA得票:<%=rs2.getString("JAVA")%>票<br>
DELPHI得票:<%=rs2.getString("DELPHI")%>票<br>
ASP得票:<%=rs2.getString("ASP")%>票<br>
ASP.NET得票:<%=rs2.getString("ASPNET")%>票<br>
JSP得票:<%=rs2.getString("JSP")%>票<br>
其他得票:<%=rs2.getString("OTHER")%>票
</td></tr><%
}
ResultSet rs3=stmt.executeQuery("select * from tb_borrowbook where id=1");
if(rs3.next())
{
%>
<tr><td><h4>3、您最愿意购买或借阅哪类图书?</h4></td></tr>
<tr><td>
入门类图书得票:<%=rs3.getString("rumen")%>票<br>
讲解+实例类得票:<%=rs3.getString("jiangjie")%>票<br>
完全实例类得票:<%=rs3.getString("wanquan")%>票<br>
百例型类得票:<%=rs3.getString("baili")%>票<br>
技巧类得票:<%=rs3.getString("jiqiao")%>票<br>
</td></tr>
<%}
%>
</table>
<p align="center" class="style1"><a href="tuichu.jsp">退出</a></p>
</body>
</html>
------------------------------------------------------------------为什么 写不进去!!!!!!!!!!!页面根本没反映 数据库保证能连上 但写不进去数据!
解决方案 »
- 高分求助Javamail邮件发送问题,熟悉的进
- 在Jsp页面怎么写图片或Flash的本地地址
- java.lang.IllegalStateException: SRVE0199E: 已获取了 OutputStream
- 新手小问题,帮忙解决一下。。。谢谢各位~~
- 小弟菜鸟,问一个基础问题,大家帮忙,不吝赐教啊
- lomboz中的server配置问题。
- 请高手们赐教!!数据库问题
- 怎么得到标准格式的当前日期时间
- AWUSOFT() 进来接分~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
- 字符串转换问题. 会者请帮我.
- 有关JSP中Cookie的问题
- C#加密,JAVA解密的问题
sql语句的语法有问题set后边应该是字段名,你那怎么是变量名,还是先在查询分析器试好了再往程序里放吧.
1.首先有楼上说的问题,但不全是,只要你确定字段名,使用变量名一样OK
如果以type为例,aa变量值为"kaifa"时
stmt.executeUpdate("update tb_borrowbook set "+aa+"= "+aa+" + 1 where id=1");
==
stmt.executeUpdate("update tb_borrowbook set kaifa= kaifa + 1 where id=1");
其中kaifa + 1你作什么理解?2.没用过这种方法,在我的印象中一个statement只有一次作用,另一种说法就是你中for循环多次调用同一个statement是没有用的,改正为batch方式,在for循环中添加batch,for循环完成后执行batch.3.另外建议.别在for循环中写try...catch
那不是每个字段都要写一个更新语句哦 这样就麻烦大了 有没有其他的办法呢?
......
String type[]=request.getParameterValues("type");
.....
if(type!=null)
{
for(int i=0;i<type.length;i++)
{
String aa=type[i];//特别是这个,在这里有什么作用哦 还不理解