📄 db_execsql.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%Option Explicit%>
<!--#include file="../../Conn.asp"-->
<!--#include file="../../SysCls/KS_CommonCls.asp"-->
<!--#include file="../Inc/Session.asp"-->
<%
'===================================================================================================================
'软件名称:科汛网站管理系统
'当前版本:科汛网站管理系统 V2.2 SP2 Free
'Copyright (C) 2006-2008 Kesion.Com All rights reserved.
'产品咨询QQ:9537636,41904294
'技术支持QQ:111394,54004407
'程序版权:科汛网络
'程序开发:科汛网络开发组(总策划:林文仲)
'E-Mail :kesioncms@hotmail.com webmaster@kesion.com
'官方网站:http://www.kesion.com
'演示站点:http://test.kesion.com
'郑重声明:
' ①、免费版本请在程序首页保留版权信息,并做上本站LOGO友情连接,商业版本无此要求;
' ②、任何个人或组织不得在授权允许的情况下删除、修改、拷贝本软件及其他副本上一切关于版权的信息;
' ③、科汛网络保留此软件的法律追究权利
'===================================================================================================================
Dim KSCls
Set KSCls = New ExecSQL
KSCls.Execute()
Set KSCls = Nothing
Class ExecSQL
Private KSCMS
Private Sub Class_Initialize()
Set KSCMS=New CommonCls
End Sub
Private Sub Class_Terminate()
Call KSCMS.CloseConn()
Set KSCMS=Nothing
End Sub
Public Sub Execute()
If Not KSCMS.ReturnPowerResult(0, "KMCT20004") Then '检查在线执行SQL语句
Response.Write("<Script>parent.frames['BottomFrame'].location.href='javascript:history.back();';</script>")
Response.End
End If
Response.Write "<html>"
Response.Write "<head>"
Response.Write "<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"
Response.Write "<title>在线执行SQL语句</title>"
Response.Write "<link href=""../Inc/Admin_Style.CSS"" rel=""stylesheet"" type=""text/css"">"
Dim Action:Action=KSCMS.G("Action")
IF Action="Result" Then
Response.Write ("<body style=""margin:1;"">")
Call ExecuteSql
Else
Response.Write ("<body scroll=no>")
Response.Write "<table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""0"" class=""sortbutton"">"
Response.Write " <tr>"
Response.Write " <td height=""23"" align=""center""><strong>在线执行SQL语句</strong>"
Response.Write "</td>"
Response.Write "</tr>"
Response.Write "</table>"
%>
<script language="javascript">
<!--
function CheckForm()
{if (document.ExecuteForm.Sql.value=='')
{
alert('请输入SQL查询语句!');
document.ExecuteForm.Sql.focus();
return false;
}
ExecuteSQLFrame.location.href="DB_ExecSQL.asp?Action=Result&SQL="+document.ExecuteForm.Sql.value;
return false;
}
-->
</script>
<table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<form name="ExecuteForm" method="post" action="?" onsubmit="return CheckForm()">
<tr height="50">
<td>
<textarea name="Sql" rows="5" wrap="OFF" style="width:100%;"></textarea>
<input type="hidden" name="Action" value="Execute">
</td>
</tr>
<tr height="25">
<td align="center">
<input type="submit" name="submit1" value="立即执行"><span style="color:red">一次仅能执行一条SQL语句,如果您没有一定的SQL基础,建议不要使用!</span>
</td>
</tr>
</form>
<tr>
<td valign="_top"><iframe id="ExecuteSQLFrame" scrolling="auto" src="DB_ExecSQL.asp?Action=Result" style="width:100%;height:93%" frameborder=1></iframe></td>
</tr>
</table>
<% End iF%>
</BODY>
</HTML>
<%
End Sub
Sub ExecuteSQL()
Dim SelectSQLTF,ExecSQLErrorTF,ExeResultNum,ExeResult,FiledObj
Dim Sql:Sql =request.querystring("Sql")
if SQL="" Then Exit Sub
If Instr(1,lcase(Sql),"delete from ks_log")<>0 then
Call KSCMS.AlertHistory("对不起,不能删除日志表数据!",-1)
Exit Sub
End If
SelectSQLTF = (LCase(Left(Trim(Sql),6)) = "select")
Conn.Errors.Clear
On Error Resume Next
if SelectSQLTF = True then
Set ExeResult = Conn.Execute(Sql,ExeResultNum)
else
Conn.Execute Sql,ExeResultNum
end if
If Conn.Errors.Count<>0 Then
ExecSQLErrorTF = True
Set ExeResult = Conn.Errors
Else
ExecSQLErrorTF = False
End If
if ExecSQLErrorTF = True then
%>
<table width="100%" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr bgcolor="F4F4EA">
<td height="20" nowrap>
<div align="center">错误号</div></td>
<td height="20" nowrap>
<div align="center">来源</div></td>
<td height="20" nowrap>
<div align="center">描述</div></td>
<td height="20" nowrap>
<div align="center">帮助</div></td>
<td height="20" nowrap>
<div align="center">帮助文档</div></td>
</tr>
<tr height="20" bgcolor="#FFFFFF">
<td nowrap>
<% = Err.Number %> </td>
<td nowrap>
<% = Err.Description %> </td>
<td nowrap>
<% = Err.Source %> </td>
<td nowrap>
<% = Err.Helpcontext %> </td>
<td nowrap>
<% = Err.HelpFile %> </td>
</tr>
</table>
<%
else
%>
<table border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<%
if SelectSQLTF = True then
%>
<tr>
<%
For Each FiledObj In ExeResult.Fields
%>
<td nowrap bgcolor="F4F4EA" height="26"><div align="center">
<% = FiledObj.name %>
</div></td>
<%
next
%>
</tr>
<%
do while Not ExeResult.Eof
%>
<tr height="20" nowrap bgcolor="#ffffff" onMouseOver="this.style.background='#F5f5f5'" onMouseOut="this.style.background='#FFFFFF'">
<%
For Each FiledObj In ExeResult.Fields
%>
<td>
<div align="center">
<%
if IsNull(FiledObj.value) then
Response.Write(" ")
else
Response.Write(FiledObj.value)
end if
%>
</div></td>
<%
next
%>
</tr>
<%
ExeResult.MoveNext
loop
else
%>
<tr>
<td bgcolor="F4F4EA" height="26">
<div align="center">执行结果</div></td>
</tr>
<tr>
<td height="20" bgcolor="#FFFFFF">
<div align="center">
<% = ExeResultNum & "条纪录被影响"%>
</div></td>
</tr>
<%
end if
%>
</table>
<%
end if
End Sub
End Class
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -