Copyright黄三益库核心理论与实务第十六Web程式语言.pptVIP

  • 2
  • 0
  • 约1.52万字
  • 约 40页
  • 2019-11-06 发布于广东
  • 举报

Copyright黄三益库核心理论与实务第十六Web程式语言.ppt

?黃三益2007 資料庫的核心理論與實務第三版 15-* 90 public boolean Insert(String pNo, String pName, String unitPrice, String catalog) 91 throws SQLException, Exception 92 { 93 ManageDB db = new ManageDB(); 94 db.connect(); 95 if (pNo.equals()) 96 return false; 97 else if(pName.equals()) 98 return false; 99 else if(unitPrice.equals()) 100 return false; 101 else if(catalog.equals()) 102 return false; 103 104 105 String queryString = INSERT product VALUES( + pNo + , + pName 106 + , + unitPrice + , + catalog + ); 107 try 108 { 109 db.ExecuteUpdate(queryString); 110 } 111 catch (SQLException sqle) 112 { 113 error = SQLException: Could not execute the query.; 114 throw new SQLException(error); 115 } 116 db.disconnect(); 117 return true; 118 }//-- end Insert ?黃三益2007 資料庫的核心理論與實務第三版 15-* JSP程式(修改) 18 % 19 ResultSet rs = null; 20 String PrepNo = request.getParameter(PrepNo); 21 PrepNo = PrepNo.trim(); 22 String pNo = request.getParameter(pNo); 23 String pName = request.getParameter(pName); 24 String unitPrice = request.getParameter(unitPrice); 25 String catalog = request.getParameter(catalog); 26 27 28 if(product.Alter(PrepNo, pNo, pName, unitPrice, catalog)) 29 out.println(商品資料修改成功!!); 30 else 31 out.println(請輸入資料!!); 32 33 rs = product.getInfo(pNo); 34 rs.next(); 35 % ?黃三益2007 資料庫的核心理論與實務第三版 15-* 121 public boolean Alter(String PrepNo, String pNo, String pName, String unitPrice, String catalog) 122 throws SQLException, Exception 123 { 124 ManageDB db = new ManageDB(); 125 db.connect(); 126 if (pNo.equals()) 127 return false; 128 else if(pName.equals()) 129 return false; 130 else if(unitPrice.equals()) 131 return false; 132 else if(catalog.equals()) 133 return false; 134 135 136 String queryString = UPDATE product SET pNo= + pNo + ,pName= + pName + ,unitPrice= + unitPrice + ,catalog= + catalog + WHERE pNo= + PrepNo + ; Try 138 { 139 db.Exe

文档评论(0)

1亿VIP精品文档

相关文档