?? 用戶模塊添加.asp
字號(hào):
<%
dim Pri
mkmc=request("mkmc")
Pri=CheckUrl("用戶模塊添加")
%>
<!--#include virtual="/school/public/CheckUrl.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/Bkg35.jpg">
<p><font size="6" color="#ff0000">用戶模塊添加</font><br><img src="../images/yhmk.bmp" width="700">
<object id="RDS2" classid="ClsID:BD96C556-65A3-11D0-983A-00C04FC29E33" align="baseline"
border="0" width="26" height="12">
<param name="AllowAddnew" value="true">
<param name="AllowDelete" value="true">
<param name="AllowUpdate" value="true">
<param name="allowarrows" value="true">
</object>
<object id="RDS1" classid="ClsID:BD96C556-65A3-11D0-983A-00C04FC29E33" align="baseline"
border="0" width="25" height="4">
<param name="AllowAddnew" value="true">
<param name="AllowDelete" value="true">
<param name="AllowUpdate" value="true">
<param name="allowarrows" value="true">
</object>
</p>
<script language="vbscript">
public text11
PUBLIC L_MKMC
L_INS=TRUE
L_DEL=TRUE
RDS1.Server ="http://<%=request.servervariables("server_name")%>"
RDS1.Connect = "database=school;uid=sa;pwd=;dsn=school"
RDS1.SQL = "select * from USERMENU"
RDS1.ExecuteOptions = 1
RDS1.Refresh
RDS2.Server = "http://<%=request.servervariables("server_name")%>"
RDS2.Connect = "database=school;uid=sa;pwd=;dsn=school"
</script>
<div align="center"><center>
<table border="1" width="62%" bgcolor="#FED5C9">
<tr>
<td valign="top" width="63%"><p align="center">
<OBJECT align=baseline classid="clsid:00028CD1-0000-0000-0000-000000000046"
CODEBASE="http://<%=Request.ServerVariables("SERVER_NAME")%>/school/public/tdbg6.ocx"
dataSrc=#rds1 height=329 id=grid1 name=grid1 style="LEFT: 0px; TOP: 0px" width=307
border = 0 VIEWASTEXT></OBJECT>
</td>
<td valign="top" width="67%"><p align="center"><input type="button" value="添 加" NAME="INS"
onclick="recordadd()" style="font-family: 隸書; font-size: 17"></p>
<p align="center"><input type="button" NAME="DEL" value="刪 除" onclick="recorddelete()"
style="font-family: 隸書; font-size: 17"></p>
<p align="center"><input type="button" value="保 存" NAME="SUB" onclick="SubmitChanges()"
style="font-family: 隸書; font-size: 17"></p>
<p align="center"><input type="button" value="取 消" NAME="CAN" onclick="cancleupdate()"
style="font-family: 隸書; font-size: 17">
<p align="center"><input type="button" value="退 出" NAME="return" onclick="returning()"
style="font-family: 隸書; font-size: 17"></td>
</tr>
</table>
</center></div>
<script language="vbscript">
' Grid1.AllowAddnew = true
' Grid1.AllowUpdate = true
' Grid1.AllowDelete = true
' Grid1.AllowArrows = true
sub grid1_BeforeColEdit()
'grid1.editactive = true
end sub
sub recordadd()
grid1.editactive=true
INS.disabled = TRUE
IF INS.disabled = TRUE THEN
DEL.disabled = TRUE
L_INS=FALSE
END IF
rds1.recordset.addnew
GRID1.Col=0
end sub
Sub SubmitChanges()
IF L_INS = FALSE THEN
INS.disabled = FALSE
DEL.disabled = FALSE
RDS2.SQL="ALTER TABLE USERSET ADD "&TRIM(GRID1.Columns.Item(0))&" CHAR(6) NULL "
RDS2.ExecuteOptions=1
RDS2.Refresh
rds2.sql="update userset set "&TRIM(GRID1.Columns.Item(0))&"='已授權(quán)' where 用戶名='SYSTEM'"
RDS2.ExecuteOptions=1
RDS2.Refresh
L_INS=TRUE
ELSEIF L_DEL=FALSE THEN
RDS2.SQL="ALTER TABLE USERSET DROP COLUMN "&L_MKMC&" "
RDS2.ExecuteOptions = 1
RDS2.Refresh
DEL.disabled=FALSE
INS.disabled=FALSE
L_DEL=TRUE
END IF
moveflag = true
if grid1.row > 1 then
grid1.row = grid1.row -1
else
grid1.row =grid1.row +1
moveflag = false
end if
grid1.Editactive = ture
On Error resume next
RDS1.SubmitChanges
If Err.Number <> 0 Then
'RDS1.CancelUpdate
MsgBox "無法更新數(shù)據(jù)!"
End If
' if moveflag then
' grid1.row = grid1.row +1
' else
' grid1.row = grid1.row -1
' end if
End Sub
SUB GRID1_beforecolupdate(colindex,oldvalue,cancle) 'ColUpdate(colindex,oldvalue,cancle)
new_value = grid1.columns.item(colindex)
select case colindex
case 0
if new_value<>oldvalue then
RDS2.SQL="select * from usermenu where 模塊名稱='"&TRIM(OLDVALUE)&"'"
RDS2.ExecuteOptions = 1
RDS2.Refresh
IF RDS2.Recordset.RECORDCOUNT>0 THEN
MSGBOX "此模塊不得修改,以免控制權(quán)限失效!",,"提示窗口"
cancle=true
EXIT SUB
END IF
end if
RDS2.SQL="select * from usermenu where LTRIM(RTRIM(模塊名稱))='"&lTRIM(rtrim(new_value))&"'"
RDS2.ExecuteOptions = 1
RDS2.Refresh
' MSGBOX RDS2.Recordset.RECORDCOUNT
IF RDS2.Recordset.RECORDCOUNT>0 THEN
MSGBOX "此模塊已存在,請(qǐng)重新輸入!",,"提示窗口"
cancle=true
EXIT SUB
END IF
end select
END sub
sub recorddelete()
l_ok = msgbox("你真的要?jiǎng)h除此項(xiàng)目嗎!",1,"提示")
if l_ok = 1 then
L_MKMC = TRIM(GRID1.Columns.Item(0))
DEL.disabled = TRUE
IF DEL.DISABLED=TRUE THEN
INS.disabled = TRUE
L_DEL=FALSE
END IF
rds1.recordset.delete
grid1.rebind
end if
end sub
Sub CancleUpdate()
On Error Resume Next
INS.disabled = FALSE
DEL.disabled = FALSE
L_INS=TRUE
L_DEL=TRUE
RDS1.CancelUpdate
Grid1.Rebind
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 returning()
history.go(-1)
end sub
</script>
</body>
</html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -