批量复制数据
程序员文章站
2023-10-27 14:08:40
现有表special和表view数据结构相同的两个表: 复制代码 代码如下:special specialid &...
现有表special和表view数据结构相同的两个表:
special
specialid nclass name pic
1 黎明 火舞艳阳
2 张学友 地久天长
3 陈冠希 同名专辑
4 郭富城 听风的歌
view
specialid nclass name pic
1 黎明 火舞艳阳 photo/200606192321.jpg
2 张学友 地久天长 photo/200606192327.jpg
3 刘德华 如果有一天 photo/200606192328.jpg
4 郭富城 听风的歌 photo/200606192329.jpg
要将view中的pic数据批量复制到special中,(歌手名与专辑要完全相同),代码如下:
复制代码 代码如下:
special
specialid nclass name pic
1 黎明 火舞艳阳
2 张学友 地久天长
3 陈冠希 同名专辑
4 郭富城 听风的歌
view
specialid nclass name pic
1 黎明 火舞艳阳 photo/200606192321.jpg
2 张学友 地久天长 photo/200606192327.jpg
3 刘德华 如果有一天 photo/200606192328.jpg
4 郭富城 听风的歌 photo/200606192329.jpg
要将view中的pic数据批量复制到special中,(歌手名与专辑要完全相同),代码如下:
复制代码 代码如下:
<%
dim conn
dim connstr
'on error resume next
connstr="dbq="+server.mappath("p#1.mdb")+";defaultdir=;driver={microsoft access driver (*.mdb)};"
set conn=server.createobject("adodb.connection")
on error resume next
conn.open connstr
%>
<html>
<head>
<title>管理软件</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#ffffff" text="#000000" >
<table width=700 border="0" cellspacing="0" cellpadding="0" align="center"><%
const maxperpage=100
dim totalput
dim currentpage
dim totalpages
dim i,j
if not isempty(request("page")) then
currentpage=cint(request("page"))
else
currentpage=1
end if
%>
<%
set rs=server.createobject("adodb.recordset")
rs.open "select * from special inner join view on special.name =view.name and special.nclass=view.nclass",conn,1,1
if rs.eof and rs.bof then
response.write "<p align=center class=font>暂无软件</p>"
else
totalput=rs.recordcount
totalput=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*maxperpage>totalput then
if (totalput mod maxperpage)=0 then
currentpage= totalput maxperpage
else
currentpage= totalput maxperpage + 1
end if
end if
if currentpage=1 then
showcontent
showpage totalput,maxperpage,"l.asp"
else
if (currentpage-1)*maxperpage<totalput then
rs.move (currentpage-1)*maxperpage
dim bookmark
bookmark=rs.bookmark
showcontent
showpage totalput,maxperpage,"l.asp"
else
currentpage=1
showcontent
showpage totalput,maxperpage,"l.asp"
end if
end if
rs.close
end if
set rs=nothing
conn.close
set conn=nothing
sub showcontent
dim i
i=1
%>
<%do while not rs.eof%>
<tr>
<td><%dim picc,vname,vnclass
picc=rs("pic")
vname=rs("name")
vnclass=rs("nclass")%><%
sql="update special set pic='"&picc&"' where name='"&vname&"' and nclass='"&vnclass&"' "
conn.execute sql
%></td>
</tr>
<% i=i+1
if i>=maxperpage then exit do
rs.movenext
loop
%>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="21" bgcolor="#f7f7f7" align="center">
<%
end sub
function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber maxperpage
else
n= totalnumber maxperpage+1
end if
if currentpage<2 then
response.write ""
else
response.write "<a href="&filename&"?page=1>首页</a> "
response.write "<a href="&filename&"?page="¤tpage-1&">上一页</a> "
end if
if n-currentpage<1 then
response.write ""
else
response.write "<a href="&filename&"?page="&(currentpage+1)&">"
response.write "下一页</a> <a href="&filename&"?page="&n&">尾页</a>"
end if
response.write " 页次:</font><b><font color=red>"¤tpage&"</font>/"&n&"</b>页</font> "
response.write " 共<b>"&totalnumber-1&"</b>个软件 <b>"&maxperpage&"</b>个软件/页"
end function
%>
</td>
</tr>
</table>
</body>
</html>
dim conn
dim connstr
'on error resume next
connstr="dbq="+server.mappath("p#1.mdb")+";defaultdir=;driver={microsoft access driver (*.mdb)};"
set conn=server.createobject("adodb.connection")
on error resume next
conn.open connstr
%>
<html>
<head>
<title>管理软件</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#ffffff" text="#000000" >
<table width=700 border="0" cellspacing="0" cellpadding="0" align="center"><%
const maxperpage=100
dim totalput
dim currentpage
dim totalpages
dim i,j
if not isempty(request("page")) then
currentpage=cint(request("page"))
else
currentpage=1
end if
%>
<%
set rs=server.createobject("adodb.recordset")
rs.open "select * from special inner join view on special.name =view.name and special.nclass=view.nclass",conn,1,1
if rs.eof and rs.bof then
response.write "<p align=center class=font>暂无软件</p>"
else
totalput=rs.recordcount
totalput=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*maxperpage>totalput then
if (totalput mod maxperpage)=0 then
currentpage= totalput maxperpage
else
currentpage= totalput maxperpage + 1
end if
end if
if currentpage=1 then
showcontent
showpage totalput,maxperpage,"l.asp"
else
if (currentpage-1)*maxperpage<totalput then
rs.move (currentpage-1)*maxperpage
dim bookmark
bookmark=rs.bookmark
showcontent
showpage totalput,maxperpage,"l.asp"
else
currentpage=1
showcontent
showpage totalput,maxperpage,"l.asp"
end if
end if
rs.close
end if
set rs=nothing
conn.close
set conn=nothing
sub showcontent
dim i
i=1
%>
<%do while not rs.eof%>
<tr>
<td><%dim picc,vname,vnclass
picc=rs("pic")
vname=rs("name")
vnclass=rs("nclass")%><%
sql="update special set pic='"&picc&"' where name='"&vname&"' and nclass='"&vnclass&"' "
conn.execute sql
%></td>
</tr>
<% i=i+1
if i>=maxperpage then exit do
rs.movenext
loop
%>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="21" bgcolor="#f7f7f7" align="center">
<%
end sub
function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber maxperpage
else
n= totalnumber maxperpage+1
end if
if currentpage<2 then
response.write ""
else
response.write "<a href="&filename&"?page=1>首页</a> "
response.write "<a href="&filename&"?page="¤tpage-1&">上一页</a> "
end if
if n-currentpage<1 then
response.write ""
else
response.write "<a href="&filename&"?page="&(currentpage+1)&">"
response.write "下一页</a> <a href="&filename&"?page="&n&">尾页</a>"
end if
response.write " 页次:</font><b><font color=red>"¤tpage&"</font>/"&n&"</b>页</font> "
response.write " 共<b>"&totalnumber-1&"</b>个软件 <b>"&maxperpage&"</b>个软件/页"
end function
%>
</td>
</tr>
</table>
</body>
</html>
上一篇: “寺院菜”健康清新
下一篇: 解决ASP(图像)上传漏洞的方法
推荐阅读
-
Windows 安装IIS出现的问题(无法安装IIS,提示“安装程序无法复制文件IISApp.vbs”)
-
JavaScript获取Django模板中指定键值的数据,使用渲染器
-
一个手写的Vue放大镜,复制即可使用
-
linux系统挂载数据盘的方法(视频图文教程)
-
用Rsync(cwRsync)将Dreamhost的数据备份到Windows上
-
windows下rsync的数据同步安装配置方法
-
cwrsync实现从linux到windows的数据同步备份
-
JavaScript数据结构之链表的实现
-
Mysql备份多个数据库代码实例
-
mysql事件之修改事件(ALTER EVENT)、禁用事件(DISABLE)、启用事件(ENABLE)、事件重命名及数据库事件迁移操作详解