• 大小: 250KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-07
  • 语言: Java
  • 标签: java  sqlserver  

资源简介

用java和sql server做的仓库管理系统

资源截图

代码片段和文件信息

package com.jx.dao;

import java.sql.Connection;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Vector;

import com.jx.dto.CGInfo;
import com.jx.dto.GHInfo;
import com.jx.dto.Manager;
import com.jx.util.DBcon;
import com.jx.util.DateType;


public class CGDao {
public boolean addSB(CGInfo cg) {
boolean flag = false;
Connection conn = null;
PreparedStatement pst = null;
try {
conn = DBcon.getConnection();
String sql = “insert into cginfo(fnocgyserverbuymountbuytimeservernumprice) values(???????);“;
pst = conn.prepareStatement(sql);
pst.setString(1 cg.getFno());
pst.setString(2 cg.getCgy());
pst.setString(3 cg.getServer());
pst.setInt(4 cg.getBuymount());
pst.setDate(5 DateType.convertFormUtilDate(cg.getBuytime()));
pst.setString(6 cg.getServernum());
pst.setFloat(7 cg.getPrice());
if (pst.executeUpdate() > 0) {
flag = true;
}

} catch (SQLException e) {
e.printStackTrace();
} finally {
DBcon.closeConn(pst);
DBcon.closeConn(conn);
}
return flag;
}
public ResultSet query(String sql) {

Statement pst = null;
Connection conn = null;
ResultSet rs = null;

try {
conn = DBcon.getConnection();
pst = conn.createStatement(10051008);
rs = pst.executeQuery(sql);


} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {

}
return rs;
}
public CGInfo queryFno(String fno) {

PreparedStatement pst = null;
Connection conn = null;
ResultSet rs = null;
String sql=“select * from cginfo where fno=?“;
CGInfo cg=null;

try {
conn = DBcon.getConnection();
pst = conn.prepareStatement(sql);
pst.setString(1 fno);
rs = pst.executeQuery();
if(rs.next())
{
cg=new CGInfo();
cg.setFno(rs.getString(1));
cg.setCgy(rs.getString(2));
cg.setServer(rs.getString(3));
cg.setBuymount(rs.getInt(4));
cg.setBuytime(rs.getDate(5));
cg.setServernum(rs.getString(6));
cg.setPrice(rs.getFloat(7));
}



} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {

}
return cg;
}
public boolean updateFno(CGInfo cg) {
boolean flag=false;
PreparedStatement pst = null;
Connection conn = null;
ResultSet rs = null;
String sql=“update cginfo set buymount=buymount+? where fno=?“;


try {
conn = DBcon.getConnection();
pst = conn.prepareStatement(sql);
pst.setInt(1 cg.getBuymount());
pst.setString(2 cg.getFno());
rs = pst.executeQuery();
if(rs.next())
{
cg=new CGInfo();
cg.setFno(rs.getString(1));
cg.setCgy(rs.getString(2));
cg.setServer(rs.getString(3));
cg.setBuymount(rs.getInt(4));
cg.setBuytime(rs.getDate(5));
cg.setServernum(rs.getString(6));
cg.setPrice(rs.get

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2011-12-21 22:56  CangKuGL\
     文件         627  2011-12-22 04:06  CangKuGL\.classpath
     文件         384  2011-12-21 16:29  CangKuGL\.project
     目录           0  2011-12-21 16:29  CangKuGL\.settings\
     文件         629  2011-12-21 16:29  CangKuGL\.settings\org.eclipse.jdt.core.prefs
     目录           0  2011-12-26 00:16  CangKuGL\bin\
     目录           0  2011-12-26 00:16  CangKuGL\bin\com\
     目录           0  2011-12-26 00:16  CangKuGL\bin\com\jx\
     目录           0  2011-12-26 00:16  CangKuGL\bin\com\jx\dao\
     文件        3788  2011-12-26 00:16  CangKuGL\bin\com\jx\dao\CGDao.class
     文件        2251  2011-12-26 00:16  CangKuGL\bin\com\jx\dao\CKDao.class
     文件        2161  2011-12-26 00:16  CangKuGL\bin\com\jx\dao\GHDao.class
     文件        2570  2011-12-26 00:16  CangKuGL\bin\com\jx\dao\KCDao.class
     文件        3739  2011-12-26 00:16  CangKuGL\bin\com\jx\dao\ManagerDao.class
     文件        1005  2011-12-26 00:16  CangKuGL\bin\com\jx\dao\RKDao.class
     文件        2453  2011-12-26 00:16  CangKuGL\bin\com\jx\dao\XQDao.class
     目录           0  2011-12-26 00:16  CangKuGL\bin\com\jx\dto\
     文件        1739  2011-12-26 00:16  CangKuGL\bin\com\jx\dto\CGInfo.class
     文件        1895  2011-12-26 00:16  CangKuGL\bin\com\jx\dto\CKInfo.class
     文件        1519  2011-12-26 00:16  CangKuGL\bin\com\jx\dto\GHInfo.class
     文件        1257  2011-12-26 00:16  CangKuGL\bin\com\jx\dto\KCInfo.class
     文件         935  2011-12-26 00:16  CangKuGL\bin\com\jx\dto\Manager.class
     文件        1733  2011-12-26 00:16  CangKuGL\bin\com\jx\dto\RKInfo.class
     文件        1090  2011-12-26 00:16  CangKuGL\bin\com\jx\dto\XQInfo.class
     目录           0  2011-12-26 00:16  CangKuGL\bin\com\jx\frame\
     文件        2033  2011-12-26 00:16  CangKuGL\bin\com\jx\frame\CangkuHandler.class
     文件        6658  2011-12-26 00:16  CangKuGL\bin\com\jx\frame\CGJframeGL.class
     文件        4061  2011-12-26 00:16  CangKuGL\bin\com\jx\frame\CGJframeView.class
     文件        7212  2011-12-26 00:16  CangKuGL\bin\com\jx\frame\CKJframeGL.class
     文件        4857  2011-12-26 00:16  CangKuGL\bin\com\jx\frame\CKJframeView.class
     文件        2766  2011-12-26 00:16  CangKuGL\bin\com\jx\frame\Elevator.class
............此处省略88个文件信息

评论

共有 条评论