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

📄 impdatado.asp

📁 购物系统(本版为正式商业版
💻 ASP
字号:
<!--#include file="conn.asp"-->
<!--#include file="adminset.asp"-->
<%if session("admin")="" then
response.Write "<script language='javascript'>alert('网络超时或您还没有登陆!');window.location.href='login.asp';</script>"
response.End
end if
if session("flag")>1 then
response.Write "<div align=center><font size=80 color=red><b>您没有此项目管理权限!</b></font></div>"
response.End
end if
if qx20<>1 then
response.Write "<div align=center><font size=80 color=red><b>您没有此项目管理权限!</b></font></div>"
response.End
end if
%>
<%
'连接ACCESS数据库
Set connaccess = Server.CreateObject("ADODB.Connection")
Strconn="DRIVER={Microsoft Access Driver (*.mdb)}; "
Strconn=Strconn & "DBQ=" & Server.MapPath("/"&request("dbpos"))
connaccess.Open Strconn

tablename=request("tablename")  '表
imptype=request("imptype")  '导入类型
impknow=request("impknow")  '提醒
sRand=""

'response.write sRand
if impknow="2" then '备份数据库
    Randomize
    sRand=rnd
    sRand=int(sRand*1000000)
    sRand=shead&year(now)&month(now)&day(now)&"_"&hour(now)&minute(now)&second(now)&"_"&sRand
    conn.execute("select * into "&tablename&"_"&sRand&" from "&tablename)
end if
if imptype="1" then  '直接插入
    set rs=server.createobject("adodb.recordset")
	rs.open "SELECT * FROM "&tablename,connaccess,1,1
	while not rs.eof
	    Show_id=rs("Show_id")
		Show_type=rs("Show_type")
		Show_name=rs("Show_name")
		Show_yg=rs("Show_yg")
		Show_sex=rs("Show_sex")
		Show_photo=rs("Show_photo")
	    conn.execute("INSERT INTO "&tablename&"(Show_id,Show_type,Show_name,Show_yg,Show_sex,Show_photo) VALUES("&Show_id&","&Show_type&",'"&Show_name&"',"&Show_yg&","&Show_sex&","&Show_photo&")")
	    rs.movenext
	wend
	set rs=nothing
elseif imptype="2" then  '先清空数据库再插入
    conn.execute("DELETE "&tablename)
    set rs=server.createobject("adodb.recordset")
	rs.open "SELECT * FROM "&tablename,connaccess,1,1
	while not rs.eof
	    Show_id=rs("Show_id")
		Show_type=rs("Show_type")
		Show_name=rs("Show_name")
		Show_yg=rs("Show_yg")
		Show_sex=rs("Show_sex")
		Show_photo=rs("Show_photo")
	    conn.execute("INSERT INTO "&tablename&"(Show_id,Show_type,Show_name,Show_yg,Show_sex,Show_photo) VALUES("&Show_id&","&Show_type&",'"&Show_name&"',"&Show_yg&","&Show_sex&","&Show_photo&")")
	    rs.movenext
	wend
	set rs=nothing
elseif imptype="3" then  '根据ID更新
    set rs=server.createobject("adodb.recordset")
	rs.open "SELECT * FROM "&tablename,connaccess,1,1
	while not rs.eof
	    Show_id=rs("Show_id")
		Show_type=rs("Show_type")
		Show_name=rs("Show_name")
		Show_yg=rs("Show_yg")
		Show_sex=rs("Show_sex")
		Show_photo=rs("Show_photo")
	    conn.execute("IF EXISTS(SELECT Show_id FROM "&tablename&" WHERE Show_id="&Show_id&") begin UPDATE "&tablename&" SET Show_type="&Show_type&",Show_name='"&Show_name&"',Show_yg="&Show_yg&",Show_sex="&Show_sex&",Show_photo="&Show_photo&" WHERE Show_id="&Show_id&" end")
	    rs.movenext
	wend
	set rs=nothing
elseif imptype="4" then  '根据ID更新(没有就插入)
    set rs=server.createobject("adodb.recordset")
	rs.open "SELECT * FROM "&tablename,connaccess,1,1
	while not rs.eof
	    Show_id=rs("Show_id")
		Show_type=rs("Show_type")
		Show_name=rs("Show_name")
		Show_yg=rs("Show_yg")
		Show_sex=rs("Show_sex")
		Show_photo=rs("Show_photo")
	    conn.execute("IF NOT EXISTS(SELECT Show_id FROM "&tablename&" WHERE Show_id="&Show_id&") begin INSERT INTO "&tablename&"(Show_id,Show_type,Show_name,Show_yg,Show_sex,Show_photo) VALUES("&Show_id&","&Show_type&",'"&Show_name&"',"&Show_yg&","&Show_sex&","&Show_photo&") end else begin UPDATE "&tablename&" SET Show_type="&Show_type&",Show_name='"&Show_name&"',Show_yg="&Show_yg&",Show_sex="&Show_sex&",Show_photo="&Show_photo&" WHERE Show_id="&Show_id&" end")
	    rs.movenext
	wend
	set rs=nothing
end if
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../css.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {
	color: #000000;
	font-weight: bold;
}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style>
</head>

<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0" background="images/right_top2.gif">
  <tr>
    <td width="1%">&nbsp;</td>
    <td width="99%"><table width="100%" border="0" cellspacing="0" cellpadding="5">
        <tr>
          <td width="30%" height="26">&nbsp;<span class="style1">数据导入成功</span></td>
          <td width="70%" align="right">&nbsp;</td>
        </tr>
    </table></td>
  </tr>
</table>
<br>
<table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#9DB2D4">
<tr bgcolor="#FFFFFF"> 
          <td height="22" colspan="5" bgcolor="#F0F3F8"> 
            <div align="center"> 
		   <font color="red">数据导入成功!</font>
<%
if sRand<>"" then
%>
		   <font color="red">备份数据库名为:<%=tablename&"_"&sRand%></font>
<%
end if
%>
              <input type="button" name="Submit" class="go-wenbenkuang" value="返回" onClick="javascript:history.go(-1)">
            </div>    </td>
  </tr>
</table>
<br>
<!--#include file="copyright.asp"-->
</body>
</html>
<script>

⌨️ 快捷键说明

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