protected void Page_Load(object sender, EventArgs e) { DBFunction db = new DBFunction("product"); String[][] arr = db.searchByColumn("product_name"); for (int i = 0; i < arr.Length; i++) { Response.Write(arr[i][0] + "<br/>"); } String[][] arr2 = db.searchSchema("name"); for (int i = 0; i < arr2.Length; i++) { Response.Write(arr2[i][0] + "<br/>"); } String[] arr3 = db.searchByRow("product_color","黑")[0]; for (int i = 0; i < arr3.Length; i++) { Response.Write(arr3[i]); } String[] arr4 = db.searchByRow("product_price", 20, 30)[0]; for (int i = 0; i < arr4.Length; i++) { Response.Write(arr4[i] + "<br/>"); } /* String[] value = {"", "青茶", "25", "green", "L"}; String str = db.insert(arr2, value); Response.Write(str + "<br/>"); String str = db.delete("product_name", "青茶"); Response.Write(str + "<br/>"); */ }
protected void Page_Load(object sender, EventArgs e) { String dtID = Request.QueryString["deleteTypeID"]; if (dtID != null && dtID != "") { if (dbType.searchRowByColumn("name","id",dtID)[0][0]=="未分類" && dbType.searchByRow("name", "未分類").Length != 0) { if (db.searchByRow("type", dbType.searchByRow("name", "未分類")[0][0]).Length != 0) { Response.Write("<Script language='JavaScript'>alert('未分類中尚有商品');</script>"); } } else { Response.Write("" + "<script>" + "if(confirm('確認刪除?'))" + "{alert('刪除成功');document.location.href='Product.aspx?deleteType=" + dtID + "';}" + "else{alert('取消');windows.location.href='Product.aspx';}</script>"); } } String dt = Request.QueryString["deleteType"]; if (dt != null && dt!="") { deleteType(dt); } setLeftBar(); //0708每次load都先判斷是否有回傳值,第一次開網頁並沒有回傳 if (Session["account"] == null || !Session["account"].Equals("admin")) { buycarStr += "<div id='buycar'><a href='PurchaseCar.aspx'><img src='../Picture/buycar.png' /></a></div>"; } else { txtType.Visible = true; ImageButton1.Visible = true; } String del = Request.QueryString["del"]; if (del != null && del != "") { Response.Write("" + "<script>" + "if(confirm('確認刪除?'))" + "{alert('刪除成功');document.location.href='Product.aspx?delete=" + del + "';}" + "else{alert('取消');windows.location.href='Product.aspx';}</script>"); } String deleteStr = Request.QueryString["delete"]; if (deleteStr != null) { delete(deleteStr); } DBFunction dbIndex = new DBFunction("indexInfo"); String[][] infoArr = dbIndex.searchByColumn("phone"); String phone = infoArr[0][0].Replace(" ", " "); String num = Request.QueryString["num"]; String ID = Request.QueryString["ID"]; if (num != null && num != "") { if ((String)Session["account"] != null) { PutIntoCart(num,ID); } else { Response.Write("<Script language='JavaScript'>alert('請聯絡電話:" + phone + "');location.href='Product.aspx';</Script>"); } } else if(ID != null && (num == null || num=="")){ Response.Write("<Script language='JavaScript'>alert('請聯絡電話:" + phone + "');location.href='Product.aspx';</Script>"); } pageShow(20); }