📄 orderlistbean.java
字号:
package Flower.model;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
public class OrderlistBean
{
Connection con=null;
PreparedStatement pstmt=null;
ResultSet rs=null;
public boolean addOrderlist(Orderlist ol) throws Exception
{
boolean res=false;
try
{
con=DBConnect.getConnection();
pstmt=con.prepareStatement("insert into OrderList values(?,?,?,?,?)");
pstmt.setString(1,ol.getOrderid());
pstmt.setString(2,ol.getListid());
pstmt.setString(3,ol.getGoodsid());
pstmt.setLong(4,ol.getNum());
pstmt.setDouble(5,ol.getPrice());
pstmt.executeUpdate();
pstmt.close();
con.close();
res=true;
}
catch(Exception ex)
{
ex.printStackTrace();
}
return res;
}
public boolean delOrderList(String id)
{
boolean res=false;
try
{
con=DBConnect.getConnection();
pstmt=con.prepareStatement("delete from OrderList where OrderID=?");
pstmt.setString(1,id);
pstmt.executeUpdate();
pstmt.close();
con.close();
res=true;
}
catch(Exception ex)
{
ex.printStackTrace();
}
return res;
}
public boolean getID(String id)
{
boolean res=false;
try
{
con=DBConnect.getConnection();
pstmt=con.prepareStatement("select * from OrderList where OrderID=?");
pstmt.setString(1,id);
rs=pstmt.executeQuery();
if(rs.next())
{
res=true;
}
else
{
res=false;
}
rs.close();
pstmt.close();
con.close();
}
catch(Exception ex)
{
ex.printStackTrace();
}
return res;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -