📄 mssqlmanage.asp
字号:
<%
if Session("UserName") = "" then
response.Redirect "login.asp"
end if
%>
<%
session("title")="砺青站点管理系统"
session("headline")="首页 -> mssql数据库管理"
set lqsm_config= server.CreateObject("lqsm.config")
set lqsm_mssql= server.CreateObject("lqsm.mssql")
on error resume next
%>
<!--#include file="head.asp"-->
<br><br><br>
<script language='JavaScript'>
<!--
function check_input()
{
web=document.Web;
if(web.DbName.value=='')
{
alert('数据库名不能为空');
web.DbName.focus();
return false;
}
if(web.DbUserName.value=='')
{
alert('用户名不能为空');
web.DbUserName.focus();
return false;
}
if(web.DbUserPass.value=='')
{
alert('用户密码不能为空');
web.DbUserPass.focus();
return false;
}
if(web.DbFile.value=='')
{
alert('数据库名不能为空');
web.DbFile.focus();
return false;
}
if(web.LogFile.value=='')
{
alert('日志名不能为空');
web.LogFile.focus();
return false;
}
if(web.DbSize.value=='')
{
alert('分配数据空间不能为空');
web.DbSize.focus();
return false;
}
if(isNaN(web.DbSize.value))
{
alert('分配数据空间只能为数字');
web.DbSize.focus();
return false;
}
if(web.LogSize.value=='')
{
alert('分配日志空间不能为空');
web.LogSize.focus();
return false;
}
if(isNaN(web.LogSize.value))
{
alert('分配日志空间只能为数字');
web.LogSize.focus();
return false;
}
if(web.DbMaxSize.value=='')
{
alert('最大数据空间不能为空');
web.DbMaxSize.focus();
return false;
}
if(isNaN(web.DbMaxSize.value))
{
alert('最大数据空间只能为数字');
web.DbMaxSize.focus();
return false;
}
if(web.LogMaxSize.value=='')
{
alert('最大日志空间不能为空');
web.LogMaxSize.focus();
return false;
}
if(isNaN(web.LogMaxSize.value))
{
alert('最大日志空间只能为数字');
web.LogMaxSize.focus();
return false;
}
}
//-->
</script>
<%
'on error resume next
DbAction=request("DbAction")
DbName = request("DbName")
DbUserName = request("DbUserName")
DbUserPass = request("DbUserPass")
DbSize = request("DbSize")
LogSize = request("LogSize")
DbMaxSize = request("DbMaxSize")
LogMaxSize = request("LogMaxSize")
DbFile = request("DbFile")
LogFile = request("LogFile")
ErrMsg=""
page = request("page")
if page ="" or (not IsNumeric(page)) then
page = 1
end if
ret = lqsm_config.CfgGetConfig("PageSize",PageSize,ErrMsg)
if not IsNumeric(PageSize) then PageSize = 20
recb = (page-1) * cint(PageSize) +1
rece = recb + cint(PageSize) -1
if DbAction="" then
DbAction="query"
if WebIndex="" then WebIndex = lqsm_mssql.getDbList()
end if
if DbAction="query" then
IndexList = split(WebIndex,",")
%>
<table border=1 bordercolor=#888888 bordercolordark=#ffffff cellpadding=3 cellspacing=0 width=88% class='size09' align='center'>
<tr><td class='color01' bgcolor='#efefef'>序号</td>
<td class='color01' bgcolor='#efefef'>数据库名</td>
<td class='color01' bgcolor='#efefef'>用户名</td>
<td class='color01' bgcolor='#efefef'>数据空间</td>
<td class='color01' bgcolor='#efefef'>日志空间</td>
<td class='color01' bgcolor='#efefef'>删除</td>
<td class='color01' bgcolor='#efefef'>编辑</td></tr>
<%
i=1
for each Index in IndexList
if Index <> "" then
if (i >= recb) and (i <= rece) then
DbName = ""
UserName = ""
DbSize = ""
LogSize = ""
DbMaxSize = ""
LogMaxSize = ""
DbFile = ""
LogFile = ""
DbName = Index
ret = lqsm_mssql.getDbDetail(DbName,UserName,DbSize,LogSize,DbMaxSize,LogMaxSize,DbFile,LogFile,ErrMsg)
%>
<tr>
<td> <%=i%></td>
<td> <a href="MssqlManage.asp?DbAction=query_detail&DbName=<%=DbName%>"><%=DbName%></a></td>
<td> <%=UserName%></td>
<td> <%=DbMaxSize%></td>
<td> <%=LogMaxSize%></td>
<td><a href="MssqlManage.asp?DbAction=del&DbName=<%=DbName%>">删除</a></td>
<td><a href="MssqlManage.asp?DbAction=edit_disk_pre&DbName=<%=DbName%>">分配空间</a>|<a href="MssqlManage.asp?DbAction=edit_pass_pre&DbName=<%=DbName%>">用户密码</a></td>
</tr>
<%
end if
i = i+ 1
end if
next
%>
<Tr><td colspan="13" align="center"><a href="MssqlManage.asp?DbAction=add_pre">增加数据库</a></td></TR>
</table>
<br><br>
<%
pageall = cint(i / PageSize)
if (pageall * PageSize) < (i-1) then
pageall = pageall + 1
end if
response.write page & "/" & pageall
do while ii<=pageall
if ii<> page then
response.write " <A HREF=mssqlmanage.asp?page="&ii&">"&ii&"</A>"
else
response.write ii
end if
ii=ii+1
loop
response.write Msg
response.end
end if
%>
<%if DbAction="query_detail" then
DbAction="query"
ret = lqsm_mssql.getDbDetail(DbName,UserName,DbSize,LogSize,DbMaxSize,LogMaxSize,DbFile,LogFile,ErrMsg)
%>
<table border=1 bordercolor=#888888 bordercolordark=#ffffff cellpadding=3 cellspacing=0 width=65% class='size09' align='center'>
<tr><td class='color01' bgcolor='#efefef' colspan="2" align="center">数据库详细信息</td></tr>
<tr><td>数据库名</td><td> <%=DbName%></td></tr>
<tr><td>用户名</td><td> <%=UserName%> </td></tr>
<tr><td>分配数据空间</td><td> <%=DbSize%> M</td></tr>
<tr><td>分配日志空间</td><td> <%=LogSize%> M</td></tr>
<tr><td>最大数据空间</td><td> <%=DbMaxSize%> M</td></tr>
<tr><td>最大日志空间</td><td> <%=LogMaxSize%> M</td></tr>
<tr><td>数据文件</td><td> <%=DbFile%> </td></tr>
<tr><td>日志文件</td><td> <%=LogFile%> </td></tr>
<tr><td align="center" colspan="2"> <input type='button' value='返 回' onclick='history.go(-1)' name='button' style='text-align:center'></td></tr>
</table>
<%
response.end
end if%>
<%if DbAction="add_pre" then
%>
<form name="Web" action="MssqlManage.asp" onsubmit='return check_input()'>
<table border=1 bordercolor=#888888 bordercolordark=#ffffff cellpadding=3 cellspacing=0 width=65% class='size09' align='center'>
<tr><td class='color01' bgcolor='#efefef' colspan="2" align="center">请输入数据库信息</td></tr>
<input name="DbAction" type="Hidden" value="add">
<tr><td>数据库名</td><td><input name="DbName" class="form" type="Text" maxlength="100"></td></tr>
<tr><td>用户名</td><td><input name="DbUserName" class="form" type="Text" maxlength="100"></td></tr>
<tr><td>密码</td><td><input name="DbUserPass" class="form" type="Text" maxlength="100"></td></tr>
<tr><td>分配数据空间</td><td><input name="DbSize" class="form" type="Text" value="50" maxlength="100"> M</td></tr>
<tr><td>分配日志空间</td><td><input name="LogSize" class="form" type="Text" value="50" maxlength="100"> M</td></tr>
<tr><td>最大数据空间</td><td><input name="DbMaxSize" class="form" type="Text" value="50" maxlength="100"> M</td></tr>
<tr><td>最大日志空间</td><td><input name="LogMaxSize" class="form" type="Text" value="50" maxlength="100"> M</td></tr>
<tr><td>数据文件</td><td><input name="DbFile" class="form" type="Text" size="60" maxlength="100" value="d:\web\"> </td></tr>
<tr><td>日志文件</td><td><input name="LogFile" class="form" type="Text" size="60" value="d:\web\" maxlength="100"> </td></tr>
<tr><td align="center" colspan="2"><input type="Submit" value="添 加" style='text-align:center'> <input type='button' value='返 回' onclick='history.go(-1)' name='button' style='text-align:center'></td></tr>
</table>
</form>
<%
response.end
end if%>
<%if DbAction="edit_pass_pre" then
DbAction="query"
ret = lqsm_mssql.getDbDetail(DbName,DbUserName,DbSize,LogSize,DbMaxSize,LogMaxSize,DbFile,LogFile,ErrMsg)
%>
<form name="Web" action="MssqlManage.asp" onsubmit='return check_input()'>
<table border=1 bordercolor=#888888 bordercolordark=#ffffff cellpadding=3 cellspacing=0 width=65% class='size09' align='center'>
<tr><td class='color01' bgcolor='#efefef' colspan="2" align="center">请输入数据库信息</td></tr>
<input name="DbAction" type="Hidden" value="edit_pass">
<input name="DbName" type="Hidden" value="<%=DbName%>">
<input name="DbUserName" type="Hidden" value="<%=DbUserName%>">
<tr><td>数据库名</td><td><%=DbName%></td></tr>
<tr><td>用户名</td><td><%=DbUserName%></td></tr>
<tr><td>密码</td><td><input name="DbUserPass" class="form" type="Text" maxlength="100"></td></tr>
<tr><td align="center" colspan="2"><input type="Submit" value="修 改" style='text-align:center'> <input type='button' value='返 回' onclick='history.go(-1)' name='button' style='text-align:center'></td></tr>
</table>
</form>
<%
response.end
end if%>
<%if DbAction="edit_disk_pre" then
DbAction="query"
ret = lqsm_mssql.getDbDetail(DbName,DbUserName,DbSize,LogSize,DbMaxSize,LogMaxSize,DbFile,LogFile,ErrMsg)
%>
<form name="Web" action="MssqlManage.asp" onsubmit='return check_input()'>
<table border=1 bordercolor=#888888 bordercolordark=#ffffff cellpadding=3 cellspacing=0 width=65% class='size09' align='center'>
<tr><td class='color01' bgcolor='#efefef' colspan="2" align="center">请输入数据库信息</td></tr>
<input name="DbAction" type="Hidden" value="edit_disk">
<input name="DbName" type="Hidden" value="<%=DbName%>">
<input name="DbUserName" type="Hidden" value="<%=DbUserName%>">
<tr><td>数据库名</td><td><%=DbName%></td></tr>
<tr><td>分配数据空间</td><td><%=DbSize%> M</td></tr>
<tr><td>分配日志空间</td><td><%=LogSize%> M</td></tr>
<tr><td>最大数据空间</td><td><input name="DbMaxSize" class="form" type="Text" maxlength="100" value="<%=DbMaxSize%>"> M</td></tr>
<tr><td>最大日志空间</td><td><input name="LogMaxSize" class="form" type="Text" maxlength="100" value="<%=LogMaxSize%>"> M</td></tr>
<tr><td>数据文件</td><td><%=DbFile%></td></tr>
<tr><td>日志文件</td><td><%=LogFile%></td></tr>
<tr><td align="center" colspan="2"><input type="Submit" value="修 改" style='text-align:center'> <input type='button' value='返 回' onclick='history.go(-1)' name='button' style='text-align:center'></td></tr>
</table>
</form>
<%
response.end
end if%>
<%
select case DbAction
case "add"
ret = lqsm_mssql.DbAdd(DbName,DbUserName,DbUserPass,DbSize,LogSize,DbMaxSize,LogMaxSize,DbFile,LogFile,ErrMsg)
case "edit_pass"
ret = lqsm_mssql.DbEdit_pass(DbName,DbUserName,DbUserPass,ErrMsg)
case "edit_disk"
ret = lqsm_mssql.DbEdit_Disk(DbName,DbMaxSize,LogMaxSize,ErrMsg)
case "del"
ret = lqsm_mssql.DbDel (DbName)
Case Else
ret = -1
ErrMsg = "不可识别动作[" & DbAction & "]"
End Select
if ret = 0 then
Msg = "交易成功"
else
Msg = "交易失败:错误码=["&ret&"]; 描述=["&ErrMsg&"]"
end if
response.write "<table width='80%' align='center'><tr><td align='center'>"&Msg&"</td></tr></table>"
%>
<!--#include file="bottom.asp"-->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -