📄 addnewbook.asp
字号:
<HTML>
<HEAD>
<Title>addnewbook.asp</Title>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<META name="Generator" content="Asp Studio 1.0">
</HEAD>
<BODY>
<%
'请在这里输入您的ASP代码
'数字判断函数,是否为正整数,不是整数就返回true,否则返回false
function IsInter(n)
if NOT IsNumeric(n) then
IsInter=true
else
Dim a,b,c
c=CInt(n)
a=CDbl(c)
b=CDbl(n)
if c<1 then
IsInter=true
else
if a<>b then
IsInter=true
else
IsInter=false
end if
end if
end if
end function
Dim bID,bName,bPub,bDate,bAuthor,bMem,bCnt,bCntLea
Dim sql
bID=Request.Form("bID")
bID=Replace(bID,"'","''",1,-1,vbTextCompare)
bName=Request.Form("bName")
bName=Replace(bName,"'","''",1,-1,vbTextCompare)
bPub=Request.Form("bPub")
bPub=Replace(bPub,"'","''",1,-1,vbTextCompare)
bDate=Request.Form("bDate")
bAuthor=Request.Form("bAuthor")
bAuthor=Replace(bAuthor,"'","''",1,-1,vbTextCompare)
bMem=Request.Form("bMem")
bMem=Replace(bMem,"'","''",1,-1,vbTextCompare)
bCnt=Request.Form("bCnt")
if bID="" then
Response.Write("2")
Response.End()
else
end if
if bName="" then
Response.Write("2")
Response.End()
else
end if
if bPub="" then
Response.Write("2")
Response.End()
else
end if
if bAuthor="" then
Response.Write("2")
response.End()
else
end if
if bMem="" then
Response.Write("2")
Response.End()
else
end if
if NOT IsDate(bDate) then
Response.Write("2")
else
if Len(bID)>30 then
Response.Write("2")
else
if Len(bName)>30 then
Response.Write("2")
else
if IsInter(bCnt) then
Response.Write("2")
else
if Len(bPub)>30 then
Response.Write("2")
else
if Len(bMem)>30 then
Response.Write("2")
else
if Len(bAuthor)>20 then
Response.Write("2")
else
Dim rs
Set rs=Session("s_DBConn").Execute("SELECT * FROM bookTable WHERE bID='"&bID&"'")
if NOT rs.EOF then
Response.Write("1")
else
bCntLea=bCnt
sql="INSERT INTO bookTable(bID,bName,bPub,bDate,bAuthor,bMem,bCnt,bCntLea) VALUES('"&bID&"','"&bName&"','"&bPub&"','"&bDate&"','"&bAuthor&"','"&bMem&"','"&bCnt&"','"&bCntLea&"')"
Session("s_DBConn").Execute(sql)
Response.Write("0")
end if
rs.Close()
set rs=Nothing
end if
end if
end if
end if
end if
end if
end if
%>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -