/webadmin/admin_db_executesql.asp代码页
<!--#include file=admin_sb.asp--><%
'====================================================================
' 请你保留这段说明,这并不会影响你的速度.   电脑交流:http://www.cnscu.cn
' 程序制作:横云			  掌上校园收倾心整理收集于互联网,感谢你的支持!
' 升级时间: 2008-2-5  		主页地址:HTTP://wap.cnscu.cn
' E-Mail: cnscu@126.com   	客服QQ:554904632 QQ群:30493504 QQ群2:46659883
'====================================================================
%> <br>
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr> 
    <td height="20">直接执SQL语句<br>
      <%
	  	call showsqlinput
		if Request.QueryString("action")="exe" Then
			Dim strsql
			strsql=Request.form("sql")
			if Request.form("rs")<>"" and strsql<>"" then
				executesql strsql,1
			elseif Request.Form("nors")<>"" and strsql<>"" then
				executesql strsql,2
			end if
		end if
	  %>
      <p></p></td>
  </tr>
</table>
<%sub showsqlinput
%>
<table width=96% align="center">
        <tr> 
          
    <td><form name="form1" method="post" action="admin_db_executesql.asp?action=exe">
        <p> 注意:待执行SQL语句(警告:执行语句要<font color="#FF0000">万分小心</font>!) <br>
          &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;执行SQL语句有两个选项,如果要求得到记录集,请点击第一个提交按钮,否则请选第二个<br>
          <br>
          <textarea name="sql" cols="80" rows="7"><%=Request.form("sql")%></textarea>
        </p>
        <p> 
          <input type="submit" name="rs" value="得到记录集">
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
          <input type="submit" name="nors" value="不要记录集">
        </p>
      </form>
      <br> </td>
        </tr>
      </table>
<%
end sub
function executesql(sql,sqltype)
	'on error resume next
	dim rs,i
	set conn = Server.CreateObject("ADODB.Connection")
	connc = "provider=microsoft.jet.oledb.4.0;" & "data source = " & server.mappath("../"&const_AccessDatabase&"")
	conn.open connc
	conn.Errors.Clear 
	Response.write "<font color=red>SQL语句:"&sql&"</font><br>"
	if sqltype=1 then
		set rs=conn.Execute (sql)
		if not rs.eof then
		%>
		<table border=1 cellspacing=0 cellpadding=0 width=600 align=center>
			 <tr>
			  <% For i=0 to Rs.Fields.Count-1%>
				 <th><%=Rs(i).Name%></th>
			  <%next%>
			</tr>
			<% While not Rs.Eof%>
			<tr>
			<% For i=0 to Rs.fields.count-1%>
				<td><%=Rs(i)%></td>
			<%Next%>
			</tr>
			<%
			Rs.movenext
			Wend
			rs.close
		end if
	elseif sqltype=2 then 
		conn.execute (sql)	
	end if
end function
%>
字母检索
回到顶部