📄 lhh_buyingview.jsp
字号:
<%@ page language="java" import="java.sql.*" %>
<%!
Connection con=null;
int iBedId=0;
int iSroomId=0;
int iBedStatus=0;
int iCheckInSeqnum=0;
int iSroomType=0;
float fBedFee=0;
int iBedNum=0;
int iBuySeqNun=0;
int iAttaBuyNum=0;
float fAttaPrice=0;
int iBedBuyNum=0;
float fBedPrice=0;
Date dBuyDate;
int iAttaAmount=0;
int iBedAmount=0;
int iStatisticBedNum=0;
String sUpdate=null;
String sInsert=null;
String sSelectquery=null;
%>
<html>
<head></head>
<body>
<!--<@ include file="head.jsp"%>
<@ include file="foot.jsp"%> -->
<jsp:include page="../head.jsp" flush="true"/>
<table width="100%" height="100%" border="1">
<tr valign="top">
<td width="25%"><div id="sectionLinks">
<h3>Section Links</h3>
<ul>
<li><a href="#">quering</a></li>
<li><a href="#">modifying</a></li>
<li><a href="#">adding</a></li>
<li><a href="#">buying</a></li>
<li><a href="#">deleting</a></li>
</ul>
</div>
</td>
<td width="53%">
<%
try{
iBuySeqNun=Integer.parseInt(request.getParameter("buySeqNum"));
iAttaBuyNum=Integer.parseInt(request.getParameter("attaNum"));
fAttaPrice=Float.parseFloat(request.getParameter("attaPrice"));
iBedBuyNum=Integer.parseInt(request.getParameter("bedNum"));
fBedPrice=Float.parseFloat(request.getParameter("bedPrice"));
dBuyDate=java.sql.Date.valueOf(request.getParameter("buyDate"));
Class.forName("com.mysql.jdbc.Driver"); // MySQL driver to connect to MySQL database
con=DriverManager.getConnection("jdbc:mysql:///lenovo_db?user=root&password=amethyst"); // Connectin to database by giving databasename and giving deault username and password
sSelectquery="select * from storage";
Statement st=con.createStatement();
ResultSet rs=st.executeQuery(sSelectquery);
while(rs.next())
{
iAttaAmount=rs.getInt(1);
iBedAmount=rs.getInt(2);
}
rs.close();
st.close();
iAttaAmount=iAttaAmount+iAttaBuyNum;
iBedAmount=iBedAmount+iBedBuyNum;
sUpdate="update storage set atta_amount=?,bed_amount=?";
PreparedStatement ps = con.prepareStatement(sUpdate);
ps.setInt(1,iAttaAmount);
ps.setInt(2,iBedAmount);
ps.executeUpdate();
sInsert="insert into buying values (?,?,?,?,?,?)";
ps = con.prepareStatement(sInsert);
ps.setInt(1,iBuySeqNun);
ps.setInt(2,iAttaBuyNum);
ps.setFloat(3,fAttaPrice);
ps.setInt(4,iBedBuyNum);
ps.setFloat(5,fBedPrice);
ps.setDate(6,dBuyDate);
ps.executeUpdate();
ps.close();
out.println("Successfully oprate");
//}
}
catch(Exception ex)
{
System.out.println(ex);
}
%>
</td>
<td width="22%"><div class="relatedLinks" valign="top">
<h3>Related Link Category</h3>
<ul>
<li><a href="#">Related Link</a></li>
<li><a href="#">Related Link</a></li>
<li><a href="#">Related Link</a></li>
<li><a href="#">Related Link</a></li>
<li><a href="#">Related Link</a></li>
<li><a href="#">Related Link</a></li>
</ul>
</div>
</td>
</tr>
</table>
<jsp:include page="../foot.jsp" flush="true"/>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -