DataSqlResult.asp
上传用户:jisenq
上传日期:2014-06-29
资源大小:7216k
文件大小:4k
源码类别:

数据库编程

开发平台:

ASP/ASPX

  1. <% Option Explicit %>
  2. <!--#include file="../FS_Inc/Const.asp" -->
  3. <!--#include file="../FS_InterFace/MF_Function.asp" -->
  4. <!--#include file="../FS_Inc/Function.asp" -->
  5. <!--#include file="../FS_Inc/Func_page.asp" -->
  6. <%'Copyright (c) 2006 Foosun Inc. Code by Simpwind.Xie
  7. Response.Buffer = True
  8. Response.Expires = -1
  9. Response.ExpiresAbsolute = Now() - 1
  10. Response.Expires = 0
  11. Response.CacheControl = "no-cache"
  12. Dim Sql,Result,ExeResult,ExeResultNum,ExeSelectTF,ErrorTF,FiledObj
  13. Dim I,ErrObj,conn
  14. MF_Default_Conn
  15. MF_Session_TF
  16. if not MF_Check_Pop_TF("MF017") then Err_Show
  17. Result = Request.Form("Result")
  18. if Result = "Submit" then
  19. Sql = Request.Form("Sql")
  20. Call MF_Insert_oper_Log("数据库维护","执行SQL语句:"& Request.Form("Sql") &"",now,session("admin_name"),"MF")
  21. if (Sql <> "") then
  22. If Instr(1,lcase(Sql),"delete from fs_ns_oper_log")<>0 then
  23. Sql="Select top 10 * from fs_ns_oper_log order by id desc"
  24. End If
  25. ExeSelectTF = (LCase(Left(Trim(Sql),6)) = "select")
  26. Conn.Errors.Clear
  27. On Error Resume Next
  28. if ExeSelectTF = True then
  29. Set ExeResult = Conn.ExeCute(Sql,ExeResultNum)
  30. else
  31. Conn.ExeCute Sql,ExeResultNum
  32. end if
  33. If Conn.Errors.Count<>0 Then
  34. ErrorTF = True
  35. Set ExeResult = Conn.Errors
  36. Else
  37. ErrorTF = False
  38. End If
  39. end if
  40. end if
  41. %>
  42. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  43. <html>
  44. <head>
  45. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  46. <title>执行结果</title>
  47. </head>
  48. <link href="images/skin/Css_<%=Session("Admin_Style_Num")%>/<%=Session("Admin_Style_Num")%>.css" rel="stylesheet" type="text/css">
  49. <body topmargin="2" leftmargin="2">
  50. <%
  51. if Result = "Submit" then
  52. if ErrorTF = True then
  53. %>
  54. <table width="100%" border="0" cellpadding="3" cellspacing="1" class="table">
  55.   <tr class="xingmu"> 
  56.     <td height="20" nowrap class="xingmu"> 
  57.       <div align="center">错误号</div></td>
  58.     <td height="20" nowrap class="xingmu"> 
  59.       <div align="center">来源</div></td>
  60.     <td height="20" nowrap class="xingmu"> 
  61.       <div align="center">描述</div></td>
  62.     <td height="20" nowrap class="xingmu"> 
  63.       <div align="center">帮助</div></td>
  64.     <td height="20" nowrap class="xingmu"> 
  65.       <div align="center">帮助文档</div></td>
  66.   </tr>
  67.   <%
  68. For I=1 To Conn.Errors.Count
  69. Set ErrObj=Conn.Errors(I-1)
  70. %>
  71.   <tr class="hback"> 
  72.     <td nowrap class="hback"> 
  73.       <% = ErrObj.Number %> </td>
  74.     <td nowrap class="hback"> 
  75.       <% = ErrObj.Description %> </td>
  76.     <td nowrap class="hback"> 
  77.       <% = ErrObj.Source %> </td>
  78.     <td nowrap class="hback"> 
  79.       <% = ErrObj.Helpcontext %> </td>
  80.     <td nowrap class="hback"> 
  81.       <% = ErrObj.HelpFile %> </td>
  82.   </tr>
  83.   <%
  84. next
  85. %>
  86. </table>
  87. <%
  88. else
  89. %>
  90. <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  91.   <tr>
  92.     <td><table border="0" cellpadding="4" cellspacing="1" class="table">
  93.         <%
  94. if ExeSelectTF = True then
  95. %>
  96.         <tr class="habck"> 
  97.           <%
  98. For Each FiledObj In ExeResult.Fields
  99. %>
  100.           <td nowrap  height="26" class="xingmu"><div align="center"> 
  101.               <% = FiledObj.name %>
  102.             </div></td>
  103.           <%
  104. next
  105. %>
  106.         </tr>
  107.         <%
  108. do while Not ExeResult.Eof
  109. %>
  110.         <tr class="hback"> 
  111.           <%
  112. For Each FiledObj In ExeResult.Fields
  113. %>
  114.           <td nowrap class="hback"> <div align="center"> 
  115.               <%
  116.  if IsNull(FiledObj.value) then
  117.   Response.Write("&nbsp;")
  118.  else
  119.   Response.Write(FiledObj.value)
  120.  end if
  121.  %>
  122.             </div></td>
  123.           <%
  124. next
  125. %>
  126.         </tr>
  127.         <%
  128. ExeResult.MoveNext
  129. loop
  130. else
  131. %>
  132.         <tr class="xingmu"> 
  133.           <td class="xingmu" height="26"> <div align="center">执行结果</div></td>
  134.         </tr>
  135.         <tr class="hback"> 
  136.           <td class="hback"> <div align="center"> 
  137.               <% = ExeResultNum & "条纪录被影响"%>
  138.             </div></td>
  139.         </tr>
  140.         <%
  141. end if
  142. %>
  143.       </table></td>
  144.   </tr>
  145. </table>
  146. <%
  147. end if
  148. end if
  149. %>
  150. <form name="ExecuteForm" method="post" action="">
  151.   <input type="hidden" name="Sql">
  152.   <input type="hidden" name="Result">
  153. </form>
  154. </body>
  155. </html>
  156. <%
  157. Set Conn = Nothing
  158. Set ExeResult = Nothing
  159. %>