直接执SQL语句
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
%>
%>
注意:待执行SQL语句(警告:执行语句要万分小心!)
执行SQL语句有两个选项,如果要求得到记录集,请点击第一个提交按钮,否则请选第二个
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 "SQL语句:"&sql&""
if sqltype=1 then
set rs=conn.Execute (sql)
if not rs.eof then
%>
Rs.movenext
Wend
rs.close
end if
elseif sqltype=2 then
conn.execute (sql)
end if
end function
%>