?? addproduct.asp
字號:
<!-- #include file="admin_protect.inc" -->
<!-- #include file="../opendb.inc" -->
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta Name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta Name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; chaRset=gb2312">
<title>添加配送商頁面</title>
</head>
<body>
<script language="JavaScript">
</script>
<p align="center"><font color="#0000FF"><b>添加新商品</b></font></p>
<form method="POST" Name="addproduct" action="addproduct.asp">
<div align="center">
<center>
<table border="1" cellspacing="1" width="50%" id="AutoNumber1" height="275">
<tr>
<td width="50%">商品名稱</td>
<td width="50%"><input type="text" Name="Name" size="20"></td>
</tr>
<tr>
<td width="50%">重 量</td>
<td width="50%"><input type="text" Name="quantity" size="20"></td>
</tr>
<tr>
<td width="50%">單個數目</td>
<td width="50%"><input type="text" Name="unit" size="20"></td>
</tr>
<tr>
<td width="50%">單 價</td>
<td width="50%"><input type="text" Name="unitprice" size="20"></td>
</tr>
<tr>
<td width="50%">庫存數目</td>
<td width="50%"><input type="text" Name="unitsinstock" size="20"></td>
</tr>
<tr>
<td width="50%">訂貨數目</td>
<td width="50%"><input type="text" Name="unitsonorder" size="20"></td>
</tr>
<tr>
<td width="50%">圖 片</td>
<td width="50%"> </td>
</tr>
</table>
</center>
</div>
<p align="center"><input type="submit" value="添加商品" Name="Submit">
<input type="reset" value="重新填寫" Name="B2"><input type="hidden" Name="action" value="addproduct"></p>
</form>
<p align="center"> </p>
</body>
</html>
<%
If Request("Action")<>"addproduct" Then
Response.End
Else
If Request("Action")="addproduct" Then
Name=Request("Name")
If Name ="" Then
'response.Redirect "Error.Asp?Error=001"
Response.Write"<script language=javascript>alert('配送商名稱不能為空!');"
Response.Write"Javascript:history.go(-1)</script>"
Response.End
End If
Set Conn=Server.CreateObject("ADODB.Connection")
Conn.Open(sqlOpenDB) '打開數據庫
Set Rs=Server.CreateObject("ADODB.RecordSet")
Rs.Open "Select * From Product Where Name='"&Name&"'",Conn
If Not Rs.Eof Then
Response.Redirect "Error.Asp?Error=004"
Response.End
End If
Set Rs=Nothing
Set Rs=Server.CreateObject("ADODB.RecordSet")
Rs.Open"Product",Conn,1,3
Conn.Execute "Insert Into Product (Name) Values ('"&Name&"')"
Response.Redirect "Success.Asp?Success=013"
End If
End If
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -