欢迎来到天天文库
浏览记录
ID:49922022
大小:178.05 KB
页数:28页
时间:2020-03-05
《超市系统的源代码.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、}//获得指定商品信息publicstaticString[]getRowStock(Stringid){String[]s=newString[6];1.DBUtil_SM.class自定义了各种对数据操作的静态方法,包括对各个数据库的增删改查,其中对于user表中的删除仅能由权限2以上的管理人员执行,代码如下(手工编写)packagepaim;importjava.sql.*;importjava.util.*;importjava.io.*;publicclassDBUtil_SM{//获取用户信息publicstaticListgetVIPLis
2、t(){ArrayListvl=newArrayList();try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");Connectioncon=DriverManager.getConnection("jdbc:odbc:dbsm","","");Statementst=con.createStatement();Stringsql="selectid,name,age,sex,workuntil,tel,lvl,totalfromVIP_IM";ResultSetrs=st.execut
3、eQuery(sql);while(rs.next()){String[]s=newString[8];for(inti=0;igetStockList(){ArrayListsl=newArrayList4、>();try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");Connectioncon=DriverManager.getConnection("jdbc:odbc:dbsm","","");Statementst=con.createStatement();Stringsql="selectid,name,price,count,vprice,typefromstockorderbytype";ResultSetrs=st.executeQuery(sql);while(rs.next()){String[]s=newStr5、ing[6];for(inti=0;i6、("jdbc:odbc:dbsm","","");Statementst=con.createStatement();Stringsql="insertintoVIP_IMvalues('"+s[0]+"','"+s[1]+"','"+s[2]+"','"+s[3]+"','"+s[4]+"','"+s[5]+"','"+s[6]+"','"+s[7]+"')";st.executeUpdate(sql);st.close();con.close();}catch(Exceptione){e.printStackTrace();}}//删除用户信息publicstaticv7、oidtoDelID(Stringid){try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");Connectioncon=DriverManager.getConnection("jdbc:odbc:dbsm","","");Statementst=con.createStatement();st.executeUpdate("deletefromVIP_IMwhereid='"+id+"'");st.executeUpdate("deletefromuserwher
4、>();try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");Connectioncon=DriverManager.getConnection("jdbc:odbc:dbsm","","");Statementst=con.createStatement();Stringsql="selectid,name,price,count,vprice,typefromstockorderbytype";ResultSetrs=st.executeQuery(sql);while(rs.next()){String[]s=newStr
5、ing[6];for(inti=0;i6、("jdbc:odbc:dbsm","","");Statementst=con.createStatement();Stringsql="insertintoVIP_IMvalues('"+s[0]+"','"+s[1]+"','"+s[2]+"','"+s[3]+"','"+s[4]+"','"+s[5]+"','"+s[6]+"','"+s[7]+"')";st.executeUpdate(sql);st.close();con.close();}catch(Exceptione){e.printStackTrace();}}//删除用户信息publicstaticv7、oidtoDelID(Stringid){try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");Connectioncon=DriverManager.getConnection("jdbc:odbc:dbsm","","");Statementst=con.createStatement();st.executeUpdate("deletefromVIP_IMwhereid='"+id+"'");st.executeUpdate("deletefromuserwher
6、("jdbc:odbc:dbsm","","");Statementst=con.createStatement();Stringsql="insertintoVIP_IMvalues('"+s[0]+"','"+s[1]+"','"+s[2]+"','"+s[3]+"','"+s[4]+"','"+s[5]+"','"+s[6]+"','"+s[7]+"')";st.executeUpdate(sql);st.close();con.close();}catch(Exceptione){e.printStackTrace();}}//删除用户信息publicstaticv
7、oidtoDelID(Stringid){try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");Connectioncon=DriverManager.getConnection("jdbc:odbc:dbsm","","");Statementst=con.createStatement();st.executeUpdate("deletefromVIP_IMwhereid='"+id+"'");st.executeUpdate("deletefromuserwher
此文档下载收益归作者所有