⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exportstyle.asp

📁 一个叫做雪人的论坛源码
💻 ASP
字号:
<%
if not session("sfadmin") then response.redirect("welcome.asp")
%>
<!--#INCLUDE FILE="../inc/db_inc.asp"-->
<!--#INCLUDE FILE="../inc/md5_inc.asp"-->
<!--#INCLUDE FILE="../inc/char_inc.asp"-->

<HTML>
<HEAD>
<TITLE>Untitled Document</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK rel="stylesheet" href="admin.css" type="text/css">
</HEAD>

<BODY bgcolor="#FFFFFF" text="#000000" leftmargin="10" topmargin="10">

<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open StrConn
%>
<!--#INCLUDE FILE="checkadmin.asp"-->
<%

if request("step") = "2" then

	errstr = ""
	
	if not IsNumeric(request("styleid")) then errstr = errstr & "<LI>模板名必须为数字<BR>"
	if request("mdbfilename") = "" then errstr = errstr & "<LI>导出文件名不能为空<BR>"
	
	if errstr = "" then
		on error resume next
		err = 0
		Set mdbConn = Server.CreateObject("ADODB.Connection")
		mdbConn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath(request("mdbfilename"))
		if err > 0 then errstr = "<LI>无法连接mdb数据库文件,可能是因为服务器不支持使用access数据库,或者您指定的access数据库文件不存在!<BR>"
	end if
	if errstr = "" then
		on error resume next
		err = 0
		Set rs = mdbConn.execute("select title, template from template")
		if err > 0 then errstr = "<LI>您指定的access数据库文件不存在, 或者它不是SF模板交换文件格式!<BR>"
	end if
	if errstr = "" then
		on error resume next
		err = 0
		if not(rs.eof) then errstr = "<LI>您指定的SF模板交换文件已存在内容!<BR>"
		if err > 0 then errstr = "<LI>您指定的SF模板交换文件已存在内容!<BR>"
	end if
	if errstr = "" then
		on error resume next
		err = 0
%>
<TABLE width="100%" border="0" cellspacing="1" cellpadding="4" align="center">
  <TR> 
    <TD bgcolor="#D1E3BF" align="center">开始导出样式到指定access数据库文件...</TD>
  </TR>
</TABLE>
<%
		Set rs = Conn.Execute("SELECT top 1 * FROM sf_style where styleid=" & clng(request("styleid")))
		if not(rs.bof or rs.eof) then
			for Each fldName In rs.Fields
				if fldName.name <> "styleid" then
					response.write "<LI>正在导出 - " & fldName.name & "...<BR>"
					mdbConn.execute("insert into template(title, template) values('" & fldName.name & "', '" & rs(fldName.name) & "')")
					if err > 0 then
						response.write "<LI><font color=""red"">发生错误: 无法将数据写入access数据库文件!</font><BR>"
						exit for
					end if
				end if
			next
		end if

%>
<TABLE width="100%" border="0" cellspacing="1" cellpadding="4" align="center">
  <TR> 
    <TD bgcolor="#D1E3BF" align="center">模板导出完毕</TD>
  </TR>
</TABLE>
<%
	else
%>
<TABLE width="100%" border="0" cellspacing="1" cellpadding="4" align="center">
  <TR> 
    <TD bgcolor="#D1E3BF">错误:<BR><%= errstr %></TD>
  </TR>
</TABLE>
<%
	end if

else
%>
<FORM name="form1" method="post" action="exportstyle.asp?step=2">
  <TABLE width="100%" border="0" cellspacing="1" cellpadding="4" align="center">
    <TR> 
      <TD bgcolor="#D1E3BF" align="center" colspan="2"><B>导出样式</B></TD>
    </TR>
    <TR> 
      <TD width="30%" align="right">选择模板:</TD>
      <TD><select name="styleid">
<%
	strsql = "select styleid, title from sf_style"
	Set rs = Conn.Execute(strsql)
	if not(rs.bof or rs.eof) then
		do until rs.eof
			response.write "<option value=""" & rs("styleid") & """>" & rs("title") & "</option>"
			rs.movenext
		loop
	end if
%>
      </select></TD>
    </TR>
    <TR bgcolor="#F5F5F5">
      <TD align="right">导出到:</TD>
      <TD><INPUT type="text" name="mdbfilename" value="template.mdb" size="30">(此文件必须在当前目录下)</TD>
    </TR>
    <TR>
      <TD colspan="2" bgcolor="#DDDDDD" height="3"></TD>
    </TR>
    <TR>
      <TD colspan="2" align="center"><INPUT type="submit" name="submit" value=" 确定 "></TD>
    </TR>
  </TABLE>
</FORM>
<%
	
end if

%>
</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -