五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

SQL

2023-06-30 10:08 作者:天塵灬厭宇  | 我要投稿

package com.conn; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.management.openmbean.OpenMBeanAttributeInfoSupport; public class SqlTest { public void ins_shop(shops shop) throws SQLException { String sqlString="insert into tb_goods values("+shop.getGoodId()+","+'"'+shop.getGoodName()+'"'+","+shop.getNum()+","+shop.getPrice()+")"; Connection conn =JBconnection.getcon(); PreparedStatement ps =conn.prepareStatement(sqlString); int rSet= ps.executeUpdate(); } public void delete_shop(int id) throws SQLException { String sqlString="delete from tb_goods where goodId="+id; Connection conn =JBconnection.getcon(); PreparedStatement ps =conn.prepareStatement(sqlString); int rSet= ps.executeUpdate(); JBconnection.close(null, ps, conn); } public static ArrayList query() throws SQLException { String sqlString="select * from tb_goods "; Connection conn =JBconnection.getcon(); PreparedStatement ps =conn.prepareStatement(sqlString); ResultSet rSet= ps.executeQuery(); ArrayList stus=new ArrayList<>(); while (rSet.next()) { int id=rSet.getInt("goodId"); String name=rSet.getString("goodName"); int num=rSet.getInt("num"); Double price=rSet.getDouble("price"); shops stu= new shops(id, name, num, price); stus.add(stu); } JBconnection.close(rSet, ps, conn); return stus; } public static void main(String[] args) throws SQLException { SqlTest sqlTest=new SqlTest(); ArrayList all = sqlTest.query(); Object[][] data=new Object[all.size()][4]; for (int i = 0; i < all.size(); i++) { data[i][0]=all.get(i).getGoodId(); data[i][1]=1; } shops shops=new shops(20, "小米", 10, 4000); try { sqlTest.ins_shop(shops); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } }

SQL的評論 (共 條)

分享到微博請遵守國家法律
佳木斯市| 龙陵县| 连城县| 遵义市| 开鲁县| 永济市| 开原市| 沧州市| 景宁| 泰顺县| 龙井市| 温州市| 衢州市| 济阳县| 东海县| 河东区| 延川县| 连州市| 肇源县| 连平县| 信丰县| 定襄县| 凤庆县| 怀化市| 文成县| 邻水| 南召县| 柏乡县| 新龙县| 广德县| 治多县| 老河口市| 正定县| 苍山县| 务川| 涟源市| 石河子市| 濮阳市| 敦煌市| 繁昌县| 怀集县|