<!--#include file="conn.asp"-->
<!--#include file="check.asp"-->

<% 
 '===========================================================================================
	'软件名称：126 cms 视频影视管理系统
	'程序版权：126电影               '咨询QQ：479025
	'开发作者：magicblack(479025)    '官方网站：http://www.126oo.com/
	'Copyright (C) 2009 - ... 126oo.com  All Rights Reserved.
	'郑重声明:
	'    1、免费版本请在程序首页保留版权信息，并做上本站LOGO友情连接,商业版本无此要求;
	'    2、任何个人或组织不得以盈利为目的发布,修改,本软件及其他副本上一切关于版权的信息；
	'    3、126电影保留此软件的法律追究权利；
'==========================================================================================
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<TITLE>执行SQL语句 - 后台管理中心 - 126电影程序CMS</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<LINK href="images/css_body.css" type=text/css rel=stylesheet>
</HEAD>
<BODY>
<DIV class=bodytitle>
<DIV class=bodytitleleft></DIV>
<DIV class=bodytitletxt>执行SQL语句</DIV>
</DIV>
<%
response.Charset="GBK"
dim action
action = SafeData("RQ","action",0)

Select case action
	case "sqlexe" : sqlexe
	case else : main
End Select


sub sqlexe()
	Dim Sql,FiledObj
	Dim ExeSelectTF,ExeResult,ExeResultNum,ErrorTF

	Sql = SafeData("RF","Sql",0)
	if Sql <>"" then
		ExeSelectTF = (LCase(Left(Trim(Sql),6)) = "select")
		Database.dbConn.Errors.Clear
		
		if ExeSelectTF = True then
				Set ExeResult =Database.dbConn.ExeCute(Sql,ExeResultNum)
		else
				Database.dbConn.ExeCute Sql,ExeResultNum
		end if
		If Database.dbConn.Errors.Count<>0 Then
			ErrorTF = True
			Set ExeResult = Database.dbConn.Errors
		Else
			ErrorTF = False
		End If
	end if
	
	if ErrorTF = True then
%>
<TABLE width="96%" border=0 align=center cellpadding="5" cellSpacing=1 class=tbtitle style="BACKGROUND: #cad9ea;">
  <TBODY>
    <TR bgColor=#f5fafe>
      <TD align="center">错误号</TD>
      <TD width="20%" align="center">来源</TD>
      <TD width="7%" align="center">描述</TD>
      <TD width="8%" align="center">帮助</TD>
      <TD width="15%" align="center">帮助文档</TD>
    </TR>
	<%
	For sql_i=1 To Database.dbConn.Errors.Count
	Set ErrObj=Database.dbConn.Errors(sql_i-1)
	%>
    <TR bgcolor="#FFFFFF">
      <TD align="center"><% = ErrObj.Number %></TD>
      <TD align="center"><% = ErrObj.Description %></TD>
      <TD align="center"><% = ErrObj.Source %></TD>
	  <TD align="center"><% = ErrObj.Helpcontext %></TD>
	  <TD align="center"><% = ErrObj.HelpFile %></TD>
    </TR>
	<%next%>
  </TBODY>
</TABLE>
	<%else%>
<TABLE width="96%" border=0 align=center cellpadding="4" cellSpacing=1 class=tbtitle style="BACKGROUND: #cad9ea;">
    <TBODY>
	<%if ExeSelectTF = True then%>
      <TR bgColor=#f5fafe align="center">
	  <%For Each FiledObj In ExeResult.Fields%>
        <TD><strong><% = FiledObj.name %></strong></TD>
	  <%next%>
      </TR>
	  <%do while Not ExeResult.Eof%>
      <TR bgColor=#f5fafe align="center">
	  <%For Each FiledObj In ExeResult.Fields%>
        <TD><%if IsNull(FiledObj.value) or  FiledObj.value="" then
							Response.Write("&nbsp;")
					 	else
							Response.Write(FiledObj.value)
						end if%></TD><%next%>
      </TR>
	  <%ExeResult.MoveNext
		loop
		else%>
      <TR bgcolor="#f5fafe" align="center">
        <TD><strong>执行结果</strong></TD>
      </TR>
      <TR bgcolor="#f5fafe" align="center">
        <TD><% = ExeResultNum & "条纪录被影响"%></TD>
      </TR>
	  <%end if%>
    </TBODY>
</TABLE>
<%end if
set FiledObj = nothing
Database.c(ExeResult)

end sub

sub main()%>
<TABLE width="96%" border=0 align=center cellpadding="4" cellSpacing=1 class=tbtitle style="BACKGROUND: #cad9ea;">
  <form action="?action=sqlexe" method="post">
  <TBODY>
    <TR>
      <TD vAlign=center bgColor=#f5fafe><strong>执行SQL语句</strong></TD>
      </TR>
    <TR>
      <TD align="center" bgColor=#f5fafe><INPUT id=sql size=100 name=sql ></TD>
      </TR>
    <TR align="center" bgcolor="#f8fbfb">
      <TD><INPUT class=inputbut type=submit value=执行 name=Submit></TD>
    </TR>
  </TBODY>
  </form>
</TABLE>
<%
end sub
%>
</BODY>
</HTML>
