📄 wj_set.asp
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb_2312-80">
<meta name="tjh" content="Microsoft FrontPage Express 2.0">
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<title>违纪项目设置 欢迎使用欣科软件</title>
</head>
<body background="../images/di2001.jpg">
<object align="baseline" classid="ClsID:BD96C556-65A3-11D0-983A-00C04FC29E33" height="4"
id="RDS1" width="25" border="0">
<param name="ExecuteOptions" value="2">
<param name="FetchOptions" value="3">
<param name="SortDirection" value="-1">
<param name="InternetTimeout" value="300000">
</object>
<object align="baseline" classid="ClsID:BD96C556-65A3-11D0-983A-00C04FC29E33" height="12"
id="RDS2" width="26" border="0">
<param name="ExecuteOptions" value="2">
<param name="FetchOptions" value="3">
<param name="SortDirection" value="-1">
<param name="InternetTimeout" value="300000">
</object>
</p>
<p> <script language="vbscript">
public text11
public l_ins
l_ins=true
public l_del
l_del=true
public l_update
l_update=false
RDS1.Server ="http://<%=Request.ServerVariables("Server_name")%>"
RDS1.Connect="database=school;uid=sa;pwd=;dsn=school"
RDS1.SQL = "select * from wjset "
RDS1.Refresh
RDS2.Server = "http://<%=Request.ServerVariables("Server_name")%>"
RDS2.Connect="database=school;uid=sa;pwd=;dsn=school"
</script> </p>
<div align="center"><center>
<table border="0" width="70%" cellspacing="0" cellpadding="0" bgcolor="#B0CDDD">
<caption align="left"><img src="../images/55.gif" border="0"></caption>
<tr>
<td valign="top" width="55%">
<object align="baseline" classid="clsid:00028CD1-0000-0000-0000-000000000046"
CODEBASE="http://<%=Request.ServerVariables("SERVER_NAME")%>/school/public/tdbg6.ocx"
dataSrc="#rds1" height="100%" id="grid1" name="grid1" style="LEFT: 0px; TOP: 0px"
width="100%" codeBase="http://210.0.0.210/school/public/tdbg6.ocx" border="0" VIEWASTEXT>
</object>
</td>
<td valign="top" width="20%" bordercolorlight="#C0C0C0" bordercolor="#C0C0C0"
bordercolordark="#C0C0C0"><h5> <input type="button" value="添 加" id="ins"
name="ins" onclick="recordadd()" id="button5" name="button5"
style="font-family: 楷体_GB2312; font-size: 15"></h5>
<p> <input type="button" value="删 除" id="del" onclick="recorddelete()"
id="button6" name="button6" style="font-family: 楷体_GB2312; font-size: 15"></p>
<p> <input type="button" value="保 存" id="update1" onclick="SubmitChanges()"
id="button7" name="button7" style="font-family: 楷体_GB2312; font-size: 15"></p>
<p> <input type="button" value="取 消" onclick="cancleupdate()" id="button8"
name="button8" style="font-family: 楷体_GB2312; font-size: 15"></p>
<p> <input type="button" value="返 回" onclick="backing()" id="button9"
name="button9" style="font-family: 楷体_GB2312; font-size: 15"></p>
<p> </p>
<p> </td>
</tr>
</table>
</center></div>
<p><script language="vbscript">
grid1.AllowAddNew = true
grid1.AllowDelete = true
grid1.AllowUpdate = true
grid1.AllowArrows = true
</script> <script language="vbscript">
PUBLIC x(20,3)
public y(40,3)
public z(40,3)
PUBLIC l_button
l_button="1"
PUBLIC row_1
public l_count
public l_delete
l_delete=0
public l_tag
l_tag="1"
sub grid1_BeforeColEdit()
grid1.editactive = true
end sub
sub recordadd()
row_1=0
ins.disabled=true
del.disabled=true
grid1.editactive=true
rds1.recordset.addnew
rds1.recordset.movelast
grid1.col=0
end sub
SUB ttBeforeColUpdate(colindex,oldvalue,cancle)
new_value = grid1.columns.item(colindex)
select case colindex
case 0
if len(trim(new_value)) =0 then
msgbox "序号不能为空!请重新输入"
cancle = true
exit sub
end if
rds2.sql = "select 序号 from baseitem_set where rtrim(序号) ='" & trim(new_value) & "'"
rds2.ExecuteOptions = 1
rds2.refresh
if rds2.recordset.recordCount>0 then
msgbox "序号重复!请重新输入"
cancle = true
exit sub
end if
case 1
if len(trim(new_value)) =0 then
msgbox "项目名称不能为空!请重新输入"
cancle = true
exit sub
end if
rds2.sql = "select * from baseitem_set where rtrim(项目名称) ='" & trim(oldvalue) & "' or rtrim(项目名称) ='" & trim(new_value) & "' "
rds2.ExecuteOptions = 1
rds2.refresh
if rds2.recordset.recordCount>0 then
msgbox "此项目名称已存在表中!不得修改!"
cancle = true
exit sub
end if
case 2
if rtrim(new_value)="bit" then
if len(trim(grid1.columns.item(3)))>0 then
msgbox "宽度和小数只能为空!"
end if
cancle=false
exit sub
elseif rtrim(new_value)="int" then
if len(trim(grid1.columns.item(3)))>0 then
msgbox "宽度和小数只能为空!"
end if
cancle=false
exit sub
elseif rtrim(new_value)="datetime" then
if len(trim(grid1.columns.item(3)))>0 then
msgbox "宽度和小数只能为空!"
end if
cancle=false
exit sub
elseif rtrim(new_value)="char" then
if len(trim(grid1.columns.item(4)))>0 then
msgbox "小数只能为空!"
end if
cancle=false
exit sub
elseif rtrim(new_value)="decimal" then
exit sub
else
msgbox "数据类型输入错误,请重新输入!"
cancle=true
exit sub
end if
case 3
if rtrim(grid1.columns.item(2))="int" or rtrim(grid1.columns.item(2))="bit" or rtrim(grid1.columns.item(2))="datetime" then
if len(trim(new_value))>0 then
msgbox "因为此记录的类型是int、bit和datetime其中的一个,所以宽度不需要录入!"
cancle=true
exit sub
end if
end if
if rtrim(grid1.columns.item(2))="char" or rtrim(grid1.columns.item(2))="decimal" then
if len(trim(new_value))=0 or rtrim(new_value)="0" then
msgbox "因为此记录的类型是char和decimal中的一个,所以宽度不能为空,必须大于0 !"
cancle=true
exit sub
end if
end if
case 4
if rtrim(grid1.columns.item(2))="decimal" and len(trim(new_value))=0 then
'if len(trim(new_value))=0 then
msgbox "小数不能为空!"
cancle=true
exit sub
' end if
elseif rtrim(grid1.columns.item(2))="decimal" and rtrim(grid1.columns.item(3))="1" then
if rtrim(new_value)>"1" then
msgbox "或者小数列只能为0 !"
end if
elseif rtrim(grid1.columns.item(2))="decimal" and rtrim(grid1.columns.item(3))>"1" then
if rtrim(new_value)>rtrim(grid1.columns.item(3)) or rtrim(new_value)=rtrim(grid1.columns.item(3)) then
msgbox "小数不能等于宽度或不能大于宽度!"
end if
end if
end select
END sub
sub recorddelete()
l_ok = msgbox("你真的要删除此项目吗!",1,"提示")
if l_ok = 1 then
ins.disabled=true
del.disabled=true
rds1.recordset.delete
grid1.rebind
end if
end sub
Sub CancleUpdate()
On Error Resume Next
RDS1.CancelUpdate
Grid1.Rebind
ins.disabled=false
del.disabled=false
End Sub
Sub MoveFirst()
RDS1.Recordset.MoveFirst
End Sub
Sub MovePrevious()
If Not RDS1.Recordset.BOF Then
RDS1.Recordset.MovePrevious
End If
End Sub
Sub MoveNext()
If Not RDS1.Recordset.EOF Then
RDS1.Recordset.MoveNext
End If
End Sub
Sub MoveLast()
RDS1.Recordset.MoveLast
End Sub
Sub SubmitChanges()
moveflag = true
if grid1.row > 0 then
grid1.row = grid1.row -1
else
grid1.row =grid1.row +1
moveflag = false
end if
grid1.Editactive = False
On Error resume next
RDS1.SubmitChanges
If Err.Number <> 0 Then
'RDS1.CancelUpdate
MsgBox "无法更新数据!"
else
l_tag="0"
ins.disabled=false
del.disabled=false
End If
if moveflag then
grid1.row = grid1.row +1
else
grid1.row = grid1.row -1
end if
' l_button="1"
end sub
sub backing()
history.go(-1)
end sub
</script> <!--<IMG alt=增加 height=20 onclick=recordadd() src="../images/增加.bmp" width=20>
<IMG alt=保存 height=20 onclick=SubmitChanges() src="../images/保存.bmp" width=20>
<IMG alt=删除 height=20 onclick=recorddelete() src="../images/剪切.bmp" width=20>
<IMG alt=取消 height=20 onclick=cancleupdate() src="../images/取消.bmp" width=20>
<IMG alt=上一条 height=20 onclick=MovePrevious() src="../images/right.BMP" width=20>
<IMG alt=下一条 height=20 onclick=MoveNext() src="../images/left.bmp" width=20>
<IMG alt=第一条 height=20 onclick=movefirst() src="../images/last2.bmp">
<IMG alt=最后一条 height=20 onclick=MoveLast() src="../images/last1.bmp">//--> </p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -