📄 admin_sql.asp
字号:
<!--#include file = include.asp-->
<!--#include file = admin_checkmana.asp-->
<!--#include file="Inc/Config.asp" -->
<body>
<%
'=========================================================
'产品目录:风讯产品N系列
'软件名称:风讯站点管理系统
'当前版本:2004.I.0225
'最新更新:2004.2.10
'=========================================================
'Copyright (C) 2002-2004 cooin.com. All rights reserved.
'网站: http://www.cooin.com Foosun.net
'程序制作:轻风云(QQ:655071)
'Email:skeen@cooin.com,skeen@Foosun.net
'论坛支持:风讯在线论坛(http://bbs.cooin.com http://bbs.foosun.net)
'=========================================================
if EnoughPopedom("sql1")=1 then
Response.write"<script>alert(""[操作失败]\n\n你的权限不足!\n\n请与系统管理员联系获得足够的权限!"");location.href=""javascript:history.back()"";</script>"
Response.end
end if
Dim action
action=Request("action")
Select Case action
Case "DoCompact1"
Call DoCompact()
Case "ExeCuteSql"
Call ExeCuteSql()
Case "DoExeCuteSql1"
Call DoExeCuteSql()
End Select
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><form name="form1" method="post" action="?">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#7ED3A7">
<tr>
<td height="32" align="center" bgcolor="#F7FFF4" class="BarText">
<table width="100%" border="0" cellpadding="0" cellspacing="0" background="images/bg1.gif">
<tr>
<td height="26"> <div align="center"><b>压缩数据库</b></div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="32" align="center" bgcolor="#F7FFF4" class="BarText">注:定期对Access数据进行压缩操作,可以极大地减小库文件大小,提高数据读取性能...<br>
建意在压缩数据库前对数据库进行一次<a href="Admin_BackupDatabase.asp"><font color="#FF0000">备份</font></a>!</td>
</tr>
<tr>
<td align="center" bgcolor="#F7FFF4">
<table width="18%" border="0" cellspacing="4" cellpadding="0">
<tr>
<td> <table width="79" border="0" cellspacing="0" cellpadding="0" style="cursor:hand" onclick="if(confirm('你确定进行[压缩操作]')){form1.submit1.click()}">
<tr>
<td width="25"><img src="pic/Make_htmlOk.gif" width="73" height="20"></td>
<td width="10"> </td>
</tr>
</table></td>
<td width="30%"> <table width="76" border="0" cellspacing="0" cellpadding="0" style="cursor:hand" onclick="window.history.back();">
<tr>
<td width="25"><img src="pic/Make_htmlBack.gif" width="73" height="20"></td>
<td width="10"> </td>
</tr>
</table></td>
</tr>
</table>
<input name="submit1" type="submit" id="submit14" value="Submit" style="display:none">
<input name="action" type="hidden" id="action" value="DoCompact1"> </td>
</tr>
</table>
</form> </td>
</tr>
</table>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#7ED3A7" class="ContentTabBg">
<tr>
<td align="center" bgcolor="#F7FFF4" class="BarTitleBg">
<table width="100%" border="0" cellpadding="0" cellspacing="0" background="images/bg1.gif">
<tr>
<td height="26"> <div align="center"><b>执行Sql脚本</b></div></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="105" align="center" bgcolor="#F7FFF4" class="BarTitle">
<form action="?" method="post" name="form4" id="form4">
<table width="90%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="16" class="BarText">注:一次只能执行一条Sql语句</td>
</tr>
<tr>
<td height="81" align="center" valign="top" bgcolor="#F7FFF4">
<textarea name="Content" rows="5" wrap="OFF" class="Input" id="Content" style="width:100%;height:100%"></textarea>
</td>
</tr>
<tr>
<td align="center"><table width="25%" border="0" cellspacing="4" cellpadding="0">
<tr>
<td width="35%"> <table width="79" border="0" cellspacing="0" cellpadding="0" style="cursor:hand" onclick="if(confirm('你确定进行[Sql操作]')){form4.submit4.click()}">
<tr>
<td width="25"><img src="pic/Make_htmlOk.gif" width="73" height="20"></td>
<td width="10"> </td>
</tr>
</table></td>
<td width="30%"> <table width="79" border="0" cellspacing="0" cellpadding="0" style="cursor:hand" onclick="window.history.back();">
<tr>
<td width="25"><img src="pic/Make_htmlBack.gif" width="73" height="20"></td>
<td width="10"> </td>
</tr>
</table></td>
</tr>
</table>
<input name="submit4" type="submit" id="submit1" value="Submit" style="display:none">
<input name="action" type="hidden" id="action" value="DoExeCuteSql1">
如果你对SQL不熟悉,请尽量不要使用。否则一旦出错,将是致命的。 </td>
</tr>
</table>
</form></td>
</tr>
</table>
</body>
</html>
<%
'////////////////////////////
'//压缩数据库
Sub DoCompact()
Dim I
Dim TargetDB,ResourceDB
Dim oJetEngine
Dim Fso
Const Jet_Conn_Partial = "Provider=Microsoft.Jet.OLEDB.4.0; Data source="
Set oJetEngine = Server.CreateObject("JRO.JetEngine")
Set Fso= Server.CreateObject(FsoObjectStr)
'关闭数据库链接
Conn.Close
Set Conn=Nothing
ResourceDB=Server.MapPath("Database/#Foosun2004.asa")
If Fso.FileExists(ResourceDB) Then
'建立临时文件
TargetDB=Server.MapPath("Database/#Foosun2004.asa.bak")
If Fso.FileExists(TargetDB) Then
Fso.DeleteFile(TargetDB)
End If
oJetEngine.CompactDatabase Jet_Conn_Partial&ResourceDB,Jet_Conn_Partial&TargetDB
Fso.DeleteFile ResourceDB
Fso.MoveFile TargetDB,ResourceDB
End If
Set Fso=Nothing
Set oJetEngine=Nothing
Response.Write("<script>alert(""操作成功:\n数据库压缩完成"");window.history.back();</script>")
Response.End()
End Sub
'////////////////////////////
'//执行Sql操作
Sub DoExeCuteSql()
Dim Content
Content=Request("Content")
Err.Clear
On Error Resume Next
Conn.BeginTrans
Conn.ExeCute(Content)
If Err.Number<>0 Then
Conn.Rollback
Response.Write("<script>alert(""操作失败:\nSQL语句有误,请返回查看"");window.history.back();</script>")
Else
Conn.CommitTrans
Response.Write("<script>alert(""操作成功:\nSQL语句执行完毕"");window.history.back();</script>")
End If
Response.End()
End Sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -