批量复制数据

时间:2021-05-18

现有表Special和表view数据结构相同的两个表:
复制代码 代码如下:
Special
SpecialidNClassnamepic
1黎明火舞艳阳
2张学友地久天长
3陈冠希同名专辑
4郭富城听风的歌
view
SpecialidNClassnamepic
1黎明火舞艳阳photo/200606192321.jpg
2张学友地久天长photo/200606192327.jpg
3刘德华如果有一天photo/200606192328.jpg
4郭富城听风的歌photo/200606192329.jpg

要将VIEW中的PIC数据批量复制到Special中,(歌手名与专辑要完全相同),代码如下:
复制代码 代码如下:<%
dimconn
dimconnstr
'onerrorresumenext
connstr="DBQ="+server.mappath("p#1.mdb")+";DefaultDir=;DRIVER={MicrosoftAccessDriver(*.mdb)};"
setconn=server.createobject("ADODB.CONNECTION")
OnErrorResumeNext
conn.openconnstr
%>
<html>
<head>
<title>管理软件</title>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
</head>
<bodybgcolor="#FFFFFF"text="#000000">
<tablewidth=700border="0"cellspacing="0"cellpadding="0"align="center"><%
constMaxPerPage=100
dimtotalPut
dimCurrentPage
dimTotalPages
dimi,j
ifnotisempty(request("page"))then
currentPage=cint(request("page"))
else
currentPage=1
endif
%>
<%
setrs=server.CreateObject("adodb.recordset")
rs.open"select*fromSpecialinnerjoinviewonSpecial.name=view.nameandSpecial.NClass=view.NClass",conn,1,1
ifrs.eofandrs.bofthen
response.write"<palign=centerclass=font>暂无软件</p>"
else
totalPut=rs.recordcount
totalPut=rs.recordcount
ifcurrentpage<1then
currentpage=1
endif
if(currentpage-1)*MaxPerPage>totalputthen
if(totalPutmodMaxPerPage)=0then
currentpage=totalPutMaxPerPage
else
currentpage=totalPutMaxPerPage+1
endif
endif
ifcurrentPage=1then
showContent
showpagetotalput,MaxPerPage,"l.asp"
else
if(currentPage-1)*MaxPerPage<totalPutthen
rs.move(currentPage-1)*MaxPerPage
dimbookmark
bookmark=rs.bookmark
showContent
showpagetotalput,MaxPerPage,"l.asp"
else
currentPage=1
showContent
showpagetotalput,MaxPerPage,"l.asp"
endif
endif
rs.close
endif

setrs=nothing
conn.close
setconn=nothing
subshowContent
dimi
i=1
%>
<%dowhilenotrs.eof%>
<tr>
<td><%dimpicc,vname,vnclass
picc=rs("pic")
vname=rs("name")
vnclass=rs("nclass")%><%
sql="updateSpecialsetpic='"&picc&"'wherename='"&vname&"'andnclass='"&vnclass&"'"
conn.executesql
%></td>
</tr>
<%i=i+1
ifi>=MaxPerPagethenexitdo
rs.movenext
loop
%>
</table>
<tablewidth="100%"border="0"cellspacing="0"cellpadding="0"align="center">
<tr>
<tdheight="21"bgcolor="#F7F7F7"align="center">
<%
endsub
functionshowpage(totalnumber,maxperpage,filename)
dimn
iftotalnumbermodmaxperpage=0then
n=totalnumbermaxperpage
else
n=totalnumbermaxperpage+1
endif
ifCurrentPage<2then
response.write""
else
response.write"<ahref="&filename&"?page=1>首页</a>&nbsp;"
response.write"<ahref="&filename&"?page="&CurrentPage-1&">上一页</a>&nbsp;"
endif
ifn-currentpage<1then
response.write""
else
response.write"<ahref="&filename&"?page="&(CurrentPage+1)&">"
response.write"下一页</a><ahref="&filename&"?page="&n&">尾页</a>"
endif
response.write"&nbsp;页次:</font><b><fontcolor=red>"&CurrentPage&"</font>/"&n&"</b>页</font>"
response.write"&nbsp;共<b>"&totalnumber-1&"</b>个软件<b>"&maxperpage&"</b>个软件/页"
endfunction
%>
</td>
</tr>
</table>
</body>
</html>

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章