📄 dictionaryedit.asp
字号:
<% if Session("dictionery_status") <> "login" then response.redirect "login.asp"
%>
<%
Response.expires = 0
Response.expiresabsolute = Now() - 1
Response.addHeader "pragma", "no-cache"
Response.addHeader "cache-control", "private"
Response.CacheControl = "no-cache"
%>
<!--#include file="db.asp"-->
<%
response.buffer = true
'get key
key = request.querystring("key")
if key="" or isnull(key) then
key=request.form("key")
end if
if key="" or isnull(key) then response.redirect "dictionarylist.asp"
'get action
a=request.form("a")
if a="" or isnull(a) then
a="I" 'display with input box
end if
'get fields from form
x_ID = Request.Form("x_ID")
x_EnglishWord = Request.Form("x_EnglishWord")
x_Chinese = Request.Form("x_Chinese")
x_Yin = Request.Form("x_Yin")
' Open Connection to the database
set conn = Server.CreateObject("ADODB.Connection")
conn.Open xDb_Conn_Str
Select Case a
Case "I": ' Get a record to display
tkey = key
strsql = "SELECT * FROM [dictionary] WHERE [ID]=" & tkey
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, conn
If rs.EOF Then
Response.Clear
Response.Redirect "dictionarylist.asp"
Else
rs.MoveFirst
End If
' Get the field contents
x_ID = rs("ID")
x_EnglishWord = rs("EnglishWord")
x_Chinese = rs("Chinese")
x_Yin = rs("Yin")
rs.Close
Set rs = Nothing
Case "U": ' Update
' Open record
tkey = key
strsql = "SELECT * FROM [dictionary] WHERE [ID]=" & tkey
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, conn, 1, 2
If rs.EOF Then
Response.Clear
Response.Redirect "dictionarylist.asp"
End If
tmpFld = Trim(x_EnglishWord)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("EnglishWord") = tmpFld
tmpFld = Trim(x_Chinese)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("Chinese") = tmpFld
tmpFld = Trim(x_Yin)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("Yin") = tmpFld
rs.Update
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
Response.Clear
Response.Redirect "dictionarylist.asp"
End Select
%>
<!--#include file="header.asp"-->
<p><font size="-1">编辑单词<br><br><a href="dictionarylist.asp">回到列表</a></font></p>
<script language="JavaScript" src="ew.js"></script>
<script language="JavaScript">
<!-- start Javascript
function EW_checkMyForm(EW_this) {
return true;
}
// end JavaScript -->
</script>
<form onSubmit="return EW_checkMyForm(this);" action="dictionaryedit.asp" method="post">
<p>
<input type="hidden" name="a" value="U">
<input type="hidden" name="key" value="<%= key %>">
<table border="0" cellspacing="1" cellpadding="5" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#0099CC"><font color="#FFFFFF"><font size="-1">English Word</font> </font></td>
<td bgcolor="#F5F5F5"><font size="-1"><input type="text" name="x_EnglishWord" value="<%= x_EnglishWord %>" size=30 maxlength=50></font> </td>
</tr>
<tr>
<td bgcolor="#0099CC"><font color="#FFFFFF"><font size="-1">中文意思</font> </font></td>
<td bgcolor="#F5F5F5"><font size="-1"><input type="text" name="x_Chinese" value="<%= x_Chinese %>" size=30 maxlength=50></font> </td>
</tr>
<tr>
<td bgcolor="#0099CC"><font color="#FFFFFF"><font size="-1">音标</font> </font></td>
<td bgcolor="#F5F5F5"><font size="-1"><input type="text" name="x_Yin" value="<%= x_Yin %>" size=30 maxlength=50></font> </td>
</tr>
</table>
<p>
<input type="submit" name="Action" value="编辑">
</form>
<!--#include file="footer.asp"-->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -