一个sql查询器,自动画表格填字段


一个什么都不懂的家伙非跟我要个sql查询器
随便写了一个,当然为了数据安全,要过滤掉一个sql关键词和系统中的一些表了
哦,对了,里面的一些函数你可能不知道哪里来的,是我现在开发一些东西一直用的自己写的一个小框架
把常用的功能封装一下,写程序主要是思路,看一下代码思想就知道我的原理了
<%
function QuerySql(sql)
%>
<table width="680" cellspacing="1" cellpadding="3" border="0" bgcolor="#c7c7c7" align="center">
<%
set rs=getRs(sql)
FieldsNum=rs.Fields.Count
puts "<tr >"
for i=0 to FieldsNum-1
puts "<td style=""background:#ccc"">"&rs.Fields.item(i).name"</td>"
next
puts "</tr>"
do while not rs.eof
puts "<tr>"
for i=0 to FieldsNum-1
puts "<td>"&rs(i)"</td>"
next
puts "</tr>"
rs.movenext
loop
%>
</table>
<%
end function
%>
« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3