📄 operatebuy.java
字号:
package goods.operate;
import goods.BuygoodsBean;
import goods.Connect;
import java.sql.SQLException;
import java.sql.Statement;
public class OperateBuy
{
public void save(BuygoodsBean bgoods)
{
Connect con = new Connect() ;
try
{
Statement stmt = con.getConnection().createStatement() ;
stmt.executeUpdate("insert into buygoods values ('"+bgoods.getBname()+"','"+bgoods.getBnumber()+"','"+bgoods.getBcount()+"','"+bgoods.getBbuyprice()+"')") ;
stmt.close() ;
}
catch (SQLException e)
{
e.printStackTrace();
}
finally
{
con.close() ;
}
}
public void update(String bnumber , int count)
{
Connect con = new Connect() ;
try
{
Statement stmt = con.getConnection().createStatement() ;
stmt.executeUpdate("update buygoods set bcount=bcount+"+count+" where bnumber='"+bnumber+"'") ;
stmt.close() ;
}
catch (SQLException e)
{
e.printStackTrace();
}
finally
{
con.close() ;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -