-
大小: 3.59MB文件類型: .zip金幣: 2下載: 0 次發(fā)布日期: 2023-10-04
- 語言: 其他
- 標(biāo)簽: 購物網(wǎng)站??
資源簡介
簡單購物網(wǎng)站的源代碼,有基本的功能,學(xué)習(xí)網(wǎng)站開發(fā)可以下載參考

代碼片段和文件信息
package?com.zyl.www.basedao;
import?java.sql.Connection;
import?java.sql.DriverManager;
import?java.sql.PreparedStatement;
import?java.sql.ResultSet;
import?java.sql.SQLException;
public?class?baseDao?{
public?Connection?conn?=?null;
public?PreparedStatement?pstmt?=?null;
public?ResultSet?rs?=?null;
//1.獲取連接的方法
public?Connection?getConn(){
try?{
Class.forName(“com.mysql.jdbc.Driver“);
//Class.forName(“oracle.jdbc.driver.OracleDriver“);
//conn?=?DriverManager.getConnection(“jdbc:oracle:thin:@localhost:1521:orcl“?“maket“?“xzjy2016“);
conn?=?DriverManager.getConnection(“jdbc:mysql://localhost:3306/chap2““root““231551“);
}?catch?(Exception?e)?{
e.printStackTrace();
}
return?conn;
}
//2.實(shí)現(xiàn)通用的查詢方法
public?ResultSet?getQuery(String?sqlobject[]?objs){
try?{
conn?=?this.getConn();
pstmt?=?conn.prepareStatement(sql);
for(int?i?=?0;i pstmt.setobject(i+1?objs[i]);
}
rs?=?pstmt.executeQuery();
}?catch?(SQLException?e)?{
e.printStackTrace();
}
return?rs;
}
//3.實(shí)現(xiàn)通用的增刪改的方法
public?int?update(String?sqlobject[]?objs){
int?row??=?0;
try?{
conn?=?this.getConn();
pstmt?=?conn.prepareStatement(sql);
for(int?i?=?0;i pstmt.setobject(i+1?objs[i]);
}
row?=?pstmt.executeUpdate();
}?catch?(Exception?e)?{
//?TODO?Auto-generated?catch?block
e.printStackTrace();
}
return?row;
}
//4.關(guān)閉資源的方法
public?void?close(){
try{
if(rs?!=?null){
rs.close();
}
if(pstmt?!=?null){
pstmt.close();
}
if(conn?!=?null){
conn.close();
}
}catch(Exception?ex){
ex.printStackTrace();
}
}
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-11-12?16:32??supermarket\
?????文件?????????727??2018-11-12?16:12??supermarket\.classpath
?????文件?????????911??2018-11-12?16:12??supermarket\.project
?????目錄???????????0??2018-11-12?16:32??supermarket\.settings\
?????文件?????????364??2018-11-12?16:32??supermarket\.settings\org.eclipse.jdt.core.prefs
?????文件?????????485??2018-11-12?16:32??supermarket\.settings\org.eclipse.wst.common.component
?????文件?????????252??2018-11-12?16:32??supermarket\.settings\org.eclipse.wst.common.project.facet.core.xm
?????目錄???????????0??2018-11-12?16:17??supermarket\build\
?????目錄???????????0??2018-11-13?16:12??supermarket\build\classes\
?????目錄???????????0??2018-11-13?16:12??supermarket\build\classes\com\
?????目錄???????????0??2018-11-13?16:12??supermarket\build\classes\com\zyl\
?????目錄???????????0??2018-11-13?16:12??supermarket\build\classes\com\zyl\www\
?????目錄???????????0??2018-11-13?16:12??supermarket\build\classes\com\zyl\www\ba
?????文件????????2339??2018-11-13?16:12??supermarket\build\classes\com\zyl\www\ba
?????目錄???????????0??2018-11-13?16:12??supermarket\build\classes\com\zyl\www\dao\
?????目錄???????????0??2018-11-13?16:12??supermarket\build\classes\com\zyl\www\daoimpl\
?????文件????????5660??2018-11-13?16:12??supermarket\build\classes\com\zyl\www\daoimpl\BillDaoImpl.class
?????文件????????5362??2018-11-13?16:12??supermarket\build\classes\com\zyl\www\daoimpl\SupplierDaoImpl.class
?????文件????????6965??2018-11-13?16:12??supermarket\build\classes\com\zyl\www\daoimpl\UserDaoImpl.class
?????文件?????????491??2018-11-13?16:12??supermarket\build\classes\com\zyl\www\dao\BillDao.class
?????文件?????????523??2018-11-13?16:12??supermarket\build\classes\com\zyl\www\dao\SupplierDao.class
?????文件?????????764??2018-11-13?16:12??supermarket\build\classes\com\zyl\www\dao\UserDao.class
?????目錄???????????0??2018-11-13?16:12??supermarket\build\classes\com\zyl\www\entity\
?????文件????????1870??2018-11-13?16:12??supermarket\build\classes\com\zyl\www\entity\Bill.class
?????文件????????1497??2018-11-13?16:12??supermarket\build\classes\com\zyl\www\entity\Supplier.class
?????文件????????1879??2018-11-13?16:12??supermarket\build\classes\com\zyl\www\entity\Users.class
?????目錄???????????0??2018-11-13?16:12??supermarket\build\classes\com\zyl\www\service\
?????目錄???????????0??2018-11-13?16:12??supermarket\build\classes\com\zyl\www\serviceimpl\
?????文件????????1554??2018-11-13?16:12??supermarket\build\classes\com\zyl\www\serviceimpl\BillServiceImpl.class
?????文件????????1628??2018-11-13?16:12??supermarket\build\classes\com\zyl\www\serviceimpl\SupplierServiceImpl.class
?????文件????????2148??2018-11-13?16:12??supermarket\build\classes\com\zyl\www\serviceimpl\UserServiceImpl.class
............此處省略118個(gè)文件信息
- 上一篇:全雙工有線對(duì)講機(jī)
- 下一篇:中國二三級(jí)河流
評(píng)論
共有 條評(píng)論